473,785 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User authentication

Ted
I have figured out how to use MS SQL Server Management Studio for SQL
Server 2005, including how to create users.

At my client's offices, on my own LAN (a one man office with two
computers in a peer to peer LAN - machines running the professional
edition of WXP), and on my colleagues computers (stand alone
notebooks), SQL Server was installed allowing both local and remote
connections, and support for both Windows and SQL Server
authentication.

At my client's offices, both local and remote connections work. On our
respective notebook computer/workstations only local connections work,
unless we're connecting to our client's network, in which case remote
connections work.

So far, it would seem all is well. However, there are two issues.

1) With regard to local connections on our notebooks, I can connect to
the default server using SQLCMD without specifying any command line
arguments, while my colleages have to specify at least the machine and
server name. I don't understand why.

2) On my peer to peer LAN, MS SQL Server Management Studio can not find
the other machine that is running SQL Server, and using SQLCMD, I can't
connect to the other server when I provide the proper credentials for a
user I set up on it to use SQL Server authentication. What should I
look at in order to find out why this is and how to fix it?

Thanks

Ted

Aug 21 '06 #1
11 3958
Ted (r.*********@ro gers.com) writes:
I have figured out how to use MS SQL Server Management Studio for SQL
Server 2005, including how to create users.

At my client's offices, on my own LAN (a one man office with two
computers in a peer to peer LAN - machines running the professional
edition of WXP), and on my colleagues computers (stand alone
notebooks), SQL Server was installed allowing both local and remote
connections, and support for both Windows and SQL Server
authentication.

At my client's offices, both local and remote connections work. On our
respective notebook computer/workstations only local connections work,
unless we're connecting to our client's network, in which case remote
connections work.
I take it that at your client there is a domain controller, while your
and your colleague's LAN is only a workgroup? Things are usually much
easier with a domain. Myself, I can connect to SQL Server on my
machines, but I yet to figure out how to mount discs.
1) With regard to local connections on our notebooks, I can connect to
the default server using SQLCMD without specifying any command line
arguments, while my colleages have to specify at least the machine and
server name. I don't understand why.
Is he running SQL Server on port 1433? And does really have a default
instance?
2) On my peer to peer LAN, MS SQL Server Management Studio can not find
the other machine that is running SQL Server, and using SQLCMD, I can't
connect to the other server when I provide the proper credentials for a
user I set up on it to use SQL Server authentication. What should I
look at in order to find out why this is and how to fix it?
What happens when you connect? Do you get a message that login failed,
or a message that indicates that the server was not found at all?

Can you reach the machine for other operations, for instance to mount
network drives?

What about any firewall?

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 21 '06 #2
Ted

Erland Sommarskog wrote:
Ted (r.*********@ro gers.com) writes:
I have figured out how to use MS SQL Server Management Studio for SQL
Server 2005, including how to create users.

At my client's offices, on my own LAN (a one man office with two
computers in a peer to peer LAN - machines running the professional
edition of WXP), and on my colleagues computers (stand alone
notebooks), SQL Server was installed allowing both local and remote
connections, and support for both Windows and SQL Server
authentication.

At my client's offices, both local and remote connections work. On our
respective notebook computer/workstations only local connections work,
unless we're connecting to our client's network, in which case remote
connections work.

I take it that at your client there is a domain controller, while your
and your colleague's LAN is only a workgroup? Things are usually much
easier with a domain. Myself, I can connect to SQL Server on my
machines, but I yet to figure out how to mount discs.
That's right. The MIS there has set up three domains, and created
credentials for each of us in one of them.
1) With regard to local connections on our notebooks, I can connect to
the default server using SQLCMD without specifying any command line
arguments, while my colleages have to specify at least the machine and
server name. I don't understand why.

Is he running SQL Server on port 1433? And does really have a default
instance?
This I don't know, but can check tomorrow.
2) On my peer to peer LAN, MS SQL Server Management Studio can not find
the other machine that is running SQL Server, and using SQLCMD, I can't
connect to the other server when I provide the proper credentials for a
user I set up on it to use SQL Server authentication. What should I
look at in order to find out why this is and how to fix it?

What happens when you connect? Do you get a message that login failed,
or a message that indicates that the server was not found at all?
Specifying my UID/pwd along with the workstation's name (parameters -U,
-P, and -H) as arguments for SQLCMD, I get the following error message:

Msg 18452, Level 14, State 1, Server TEDSNEWACER, Line 1
Login failed for user 'TByers'. The user is not associated with a
trusted SQL Server connection.

I can not connect at all using SQL Server Management Studio. It does
not see the other workstation at all, and so I can't add a user,
defined on the other workstation, using it and configure it to use
Windows authentication.
Can you reach the machine for other operations, for instance to mount
network drives?
Yes. It appears in 'My Network Places', and I can easily move files
between the machines.
What about any firewall?
There are software firewalls on both machines, as well as a hardware
firewall on the router.

Thanks

Ted

Aug 21 '06 #3
Ted (r.*********@ro gers.com) writes:
Specifying my UID/pwd along with the workstation's name (parameters -U,
-P, and -H) as arguments for SQLCMD, I get the following error message:

Msg 18452, Level 14, State 1, Server TEDSNEWACER, Line 1
Login failed for user 'TByers'. The user is not associated with a
trusted SQL Server connection.
That means that the server is not configured for SQL authentication.
I can not connect at all using SQL Server Management Studio. It does
not see the other workstation at all, and so I can't add a user,
defined on the other workstation, using it and configure it to use
Windows authentication.
Windows authentication is a difficult thing to get working in a workgroup.
I have not been successful with my machines at home.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 22 '06 #4
Ted

Erland Sommarskog wrote:
Ted (r.*********@ro gers.com) writes:
Specifying my UID/pwd along with the workstation's name (parameters -U,
-P, and -H) as arguments for SQLCMD, I get the following error message:

Msg 18452, Level 14, State 1, Server TEDSNEWACER, Line 1
Login failed for user 'TByers'. The user is not associated with a
trusted SQL Server connection.

That means that the server is not configured for SQL authentication.
Thanks. I finally found the part of SQL Server Management Studio where
I can change this. It wasn't where I'd expected it to be, but I found
it and changed it, and now all problems on my LAN have been resolved.
AND all my scripts (both SQL and Perl) run on my client's server as
they do on mine.

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_i nstance). 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_i nstance on the commandline works
but connection fails if it is submitted from within a perl script.

Thanks again

Ted

Aug 22 '06 #5
Ted (r.*********@ro gers.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_i nstance).
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.
".\SQLEXPRE SS" should be sufficient.
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_i nstance 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.

Anyway, without error message and the Perl code, it's a bit difficult
to do more than to guess.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 22 '06 #6
Ted

Erland Sommarskog wrote:
Ted (r.*********@ro gers.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_i nstance).

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.
".\SQLEXPRE SS" 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_i nstance 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\nLoadin g data to temporary tables.\n";
my $cmdline = "sqlcmd -i temporary_load_ script_file.sql -o
load.output1.tx t";
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\instanc e -i temporary_load_ script_file.sql -o
load.output1.tx t

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

Aug 23 '06 #7
Ted (r.*********@ro gers.com) writes:
Can SQL Express be told to use a default instance? If so, how?
Yes. When you install SQL Express you get a screen where you can choose
the name of your instance and also select a default instance. If memory
serves the Express install has a "Show advanced install options" or
somesuch. You may have select that to get that screen.

You cannot change an existing named instance to a default instance. (Well,
with a lot of registry hacking etc you may get away with it, but please
don't try it home. Or at work.)
Here is the perl code I run on my machine:

my $cmdline = "sqlcmd -i temporary_load_ script_file.sql -o
...
sqlcmd -S glaptop\instanc e -i temporary_load_ script_file.sql -o
load.output1.tx t

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.
Of course it fails. \ in a double-quoted string in Perl is an escape
character, so you get glaptopsqlexpre ss.

Double the backslash or use single quotes to delimit the string. Even
nice is maybe to make the instance an argument:

$server = '.' unless $server;
my $cmdline = "sqlcmd -S $sserver -i temporary_load_ script_file.sql -o

In this case there is you don't have to worry about the backslash.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 23 '06 #8
Ted

Erland Sommarskog wrote:
Ted (r.*********@ro gers.com) writes:
Can SQL Express be told to use a default instance? If so, how?

Yes. When you install SQL Express you get a screen where you can choose
the name of your instance and also select a default instance. If memory
serves the Express install has a "Show advanced install options" or
somesuch. You may have select that to get that screen.
OK I am running a test of this, and to do so, I created a named
instance. This is on my own LAN, so we're dealing with a peer to peer
WXP LAN, and the developer's edition of SQL Server 2005. With local
access, everything works fine, with mixed authentication. But the
following shows what happens when I try remote access.

===========sess ion start========== ======
C:\FVA\Code>sql cmd -S RNDWORKSTATION\ QAENV -U myuid -P mypwd
HResult 0xFFFFFFFF, Level 16, State 1
SQL Network Interfaces: Error Locating Server/Instance Specified
[xFFFFFFFF].
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.

C:\FVA\Code>sql cmd -S RNDWORKSTATION -U myuid -P mypwd
1exit

C:\FVA\Code>
=============== session end============ ===

As you can see, remote access to the default instance works fine, but I
get an error when I try to access the named instance.

I have used the SQL Server Management Studio to verify that mixed
authentication, and remote connections, are enabled on the named
instance (and the uid was create in the same way, using the same pwd,
on both instances).

I assume I missed something, but what, and where do I look in SQL
Server 2005 Management Studio to find the settings I need to change to
fix this?

Thanks.

Ted

Aug 24 '06 #9
Ted (r.*********@ro gers.com) writes:
As you can see, remote access to the default instance works fine, but I
get an error when I try to access the named instance.

I have used the SQL Server Management Studio to verify that mixed
authentication, and remote connections, are enabled on the named
instance (and the uid was create in the same way, using the same pwd,
on both instances).
Mangement Studio?

A better place to look is the SQL Server Configuration Manager or the
Surface Area Configuration tool. You need to enable the new instance
for remote connections as well.

Also, a named instance may require that the SQL Browser Service is running.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 24 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3211
by: Tim Daneliuk | last post by:
OK, I've Googled for this and cannot seem to quite find what I need. So, I turn to the Gentle Geniuses here for help. Here is what I need to do from within a script: Given a username and a password (plain text): 1) Validate that the password is correct for that user *without actually logging in*. 2) If the password is valid, return a list of all the groups the user belongs to. Otherwise, return some error string.
4
17802
by: Dan Bart | last post by:
I am using an application which is a modification of IBuySpy Portal. It is using Forms authentication. Users login and their name is added to Context Then I use: Web.HttpContext.Current.User.Identity.Name to write audit trail as to what users do. Now recently on one of the activities I noticed that the
5
2390
by: Matthew Louden | last post by:
I wrote ASP.NET application that access SQL Server database. When I run the application, it yields "Login failed for user '<COMPUTER_NAME>\ASPNET'" error message. I then did the following, but still didn't work. Any ideas?? 1. In IIS console, right click the virtual directory 2. click directory security tab 3. click edit button on anonymous access 4. click browse button
8
2217
by: Joe | last post by:
I check for the NTLogin of a user by Page.User.Identity.Name, but when I put the app on the server the value for Page.User.Identity.Name is "" I had the <allow users="*/> attribute commented out on my machine and had <deny users="?"/> how do I do this on the server to get the user NTLogin
15
2927
by: Tom Nowak | last post by:
I am writing a webapp in which a user is required to enter a login id and password on a login form. I have forms authenticaion coded in my web.config. Once the user is logged in, I want to use the login id in other forms of the app. I will eventually save a record to a SQL database, and I want the login id to be automatically entered in a field on a form other than the login page. Help.
1
1429
by: noor | last post by:
hi, can any one tell me a javascript that can be called on mouseover event of a html link control . script can check from session either a user is login or not In the case of Login it will redirect to the given url. In the case of not Login it will prompt the user that u r not login kindly login. actually that link leads a user to Download Software. but this feature is only for registerd user.
2
4503
by: J | last post by:
Hello. I apologize if this isn't the appropriate group for this question but I was wondering if it's possible to allow regular windows domain users to change their passwords through an .asp page? I'm trying to figure out the best way to handle domain users to log into an .asp application tied with SQL Server 2000 on the back end since I keep reading that windows authentication is better practice to log into SQL Server. Thanks in...
3
5637
by: mario.colorado | last post by:
Hi! Does anyone know why it is that when I use: Request.LogonUserIdentity.User.ToString() I get something like: S-1-5-21-2268419..........
9
15534
by: webrod | last post by:
Hi all, how can I check a user/password in a LDAP ? I don't want to connect with this user, I would like to connect to LDAP with a ADMIN_LOG/ADMIN_PWD, then do a query to find the user and check the password. The thing is I can't access the password attribute to compare with the user's password provided.
6
5668
by: MuZZy | last post by:
Hi, I am looking to find a way to get currently logged in user's object GUID without querying ActiveDirectory. For example, when i log in to my laptop from home, I'm not on the office network so i can't reach AD but I'm sure i still can get my AD's objectGUID, as the profile is cached locally. Any ideas?
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.