You are here: Re: User authentication « MsSQL Server « IT news, forums, messages
Re: User authentication

Posted by Ted on 08/23/06 16:07

Erland Sommarskog wrote:
> Ted (r.ted.byers@rogers.com) writes:
> > There are two, probably related, differences between my notebook
> > computer and my colleagues' notebooks. 1) They are using SQL Server
> > Express 2005 and I am using the developer's edition of SQL Server 2005.
> > 2) I can connect to my server using SQLCMD without specifying any
> > command line arguments while they must specify the server machine and
> > instance (i.e. SQLCMD -S my_machine\an_instance).
>
> By default Developer Edition installs a default instance. And by default
> Express Edition installs as a named instance, SQLEXPRESS.
>
> When you say SQLCMD only, this implies a default instance on the local
> server. Thus, if you have a named instance, you need to specify this.
> ".\SQLEXPRESS" should be sufficient.
>
OK. So the ultimate cause of the differences in behaviour we're seeing
is the different default behaviour of the installation of SQL Express
version relative to the developer's, and workgroup (which I see
behaving exactly the same way on our client's machine as the
developer's edition on my machine), editions.

Can SQL Express be told to use a default instance? If so, how?

Where should I look in the documentation to learn how to create a named
instance?

> > Probably related to this, if I edit my perl script to provide the
> > additional parameters they have to submit, connection fails while the
> > very same commandline submitted on the commandline instead of through
> > Perl works. i.e. Submitting SQLCMD -S my_machine\an_instance on the
> > commandline works but connection fails if it is submitted from within a
> > perl script.
>
> It's not entirely clear, but it sounds as if you specify the instance
> name of the laptpos, when to connect the Perl scripts to your local instance
> on your workstation. That will not fly, since you have a default instance.
>
On my laptop, I don't specify the instance, but my colleagues must do
so if they are to connect.

They error they get should they try to connect without specifying the
instance is:
============================
C:\ >sqlcmd

HResult 0x2, Level 16, State 1

Named Pipes Provider: Could not open a connection to SQL Server [2].

Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred
while establishing a connection to the server. When connecting to SQL
Server 2005, this failure may be caused by the fact that under the
default settings SQL Server does not allow remote connections..

Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
===============================


> Anyway, without error message and the Perl code, it's a bit difficult
> to do more than to guess.
>

Here is the perl code I run on my machine:

print "\n\nLoading data to temporary tables.\n";
my $cmdline = "sqlcmd -i temporary_load_script_file.sql -o
load.output1.txt";
my $rv = qx/$cmdline/;
$now_string = localtime;
if (length($rv) == 0) {
print "The data has been loaded into the temporary tables now,
$now_string.\n";
print log_file "The data has been loaded into the temporary tables
now, $now_string.\n";
} else {
print "Loading data into the temporary tables failed now, at
$now_string, with the following error:\n$rv";
print log_file "Loading data into the temporary tables failed now, at
$now_string, with the following error:\n$rv";
exit;
}

When I run this, either on my workstation or on my notebook, or on my
client's machine, it works flawlessly.

If we extract the command and run it on my colleagues laptops, to get
it to run we have to change it to:

sqlcmd -S glaptop\instance -i temporary_load_script_file.sql -o
load.output1.txt

If we change the perl script to reflect this, it fails to run, and we
get the same error that we get if they try to run without specifying an
instance. Because of the error message, this seems to be related to
the default instance issue you described, but I don't understand why we
can get it to work if we modify the command to specify an instance and
run it from the commandline but not from within a perl script.

Cheers,

Ted

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация