Groups | Blog | Home
all groups > sql server connect > december 2003 >

sql server connect : Login failed for user 'userID'. Reason: Not associated with a trusted SQL Server


Alex
12/24/2003 10:40:14 AM
Hi, I'm running WinXP Pro, when I try to connect to MSSQL
Server via ASP.NET, I get an error with the message
"Login failed for user 'userID'. Reason: Not associated
with a trusted SQL."
I set up a log-in, which is set to SQL Server
Authentication, I tried enabling named pipes, and still
Foo Man Chew
12/24/2003 5:30:16 PM
Let's see your connection string. And named pipes is probably something
you'll want to avoid...



[quoted text, click to view]

Erland Sommarskog
12/25/2003 10:42:11 PM
Alex (anonymous@discussions.microsoft.com) writes:
[quoted text, click to view]

Is SQL authentication enabled on the server?

--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
kevmc NO[at]SPAM online.microsoft.com
12/26/2003 6:08:54 PM
This means that either your ASP code is written to Impersonate, or the SQL
Server is set to Windows NT Authentication, and your code is passing a SQL
username and password.

If your code needs to impersonate then the IIS machine needs to be setup
for Security Delegation using Kerberos authentication.

If you code is passing a SQL username and password, then it sounds like you
need to change the security mode of SQL Server to allow both Windows
Authentication and SQL Authentication & then restart MSSQLServer service.

See the following MSDN article for more information;
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/ht
ml/secnetlpMSDN.asp


Thanks,

Kevin McDonnell
Microsoft Corporation

This posting is provided AS IS with no warranties, and confers no rights.


CS610611 NO[at]SPAM hotmail.com
1/7/2004 4:45:05 PM
I am also having this problem. I am writing a script that connects a
web page to a SQL server database.

I know for sure that the SQL server is set to use windows
authentication only and the system admin does not want to change it to
"mix" mode. So I have to work around that decision. If I use ODBC
connection tool under Control Panel --> Admin Tools, I can connect to
the server without any problem, but when I try to connect through the
VB code, I am getting error message.

I have created a windows user to use in my script and this user has
access to the database that I am trying to connect to.

Connect string I am using in my code looks like -
strConnect = "Provider=SQLOLEDB;;Data Source=[IP address of SQL
server];Initial Catalog=[database name];user id=[windows user id
including domain name]; password=[user password];"

Is there a different "Provider" to use with windows authentication?
kevmc NO[at]SPAM online.microsoft.com
1/8/2004 1:07:17 AM
You can't connect to the server in Windows Authentication Only mode with
this connection string.

"strConnect = "Provider=SQLOLEDB;;Data Source=[IP address of SQL
server];Initial Catalog=[database name];user id=[windows user id
including domain name]; password=[user password];"

Your connection string needs to request Integrated Security if the SQL
Server is set to Windows Authentication only.

"Provider=SQLOLEDB;Data Source=server;Integrated Security=SSPI;Initial
Catalog=database;"

See:
247931 INF: Authentication Methods for Connections to SQL Server in Active
http://support.microsoft.com/?id=247931


Thanks,

Kevin McDonnell
Microsoft Corporation

This posting is provided AS IS with no warranties, and confers no rights.


CS610611 NO[at]SPAM hotmail.com
1/8/2004 8:15:11 AM
Thanks Kevin for pointing me to the correct website link. I still
have a question - Can I not specify the user login and password in the
connect string if I am using windows authentication? Because now I am
getting error message -
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

And according to the information on MSDN link, this error message
kevmc NO[at]SPAM online.microsoft.com
1/8/2004 10:43:29 PM
Question posted:
Can I not specify the user login and password in the
connect string if I am using windows authentication?.

Answer:
Correct. If the SQL Server is set for Windows Auth, you never specify the
username & password.

See the kb article below, here is a summary of the problem:

CAUSE
=====
This error occurs if SQL Server security mode is set to Microsoft Windows
NT only and the NT account that is being used to authenticate the user on
the IIS computer (such as IUSR_computer for anonymous IIS access) does not
have permissions to connect to the remote SQL Server's NT computer.

RESOLUTION
==========

Using IIS Anonymous Access

1. Using NT's User Manager Tool, create an identical NT account, such
as IUSR_localcomputer, on the remote SQL Server's NT computer. Give the
account a similar password and give it the right to "Log On Locally."

2. Using Internet Service Manager, open the Properties Sheet of the
virtual directory for the Web application, select the Directory
Security tab, click on the Edit button for Anonymous Access and
Authentication Control to display the Authentication Methods. Click the
Edit button for Allow Anonymous Access to edit the NT account used for
anonymous access, and then clear the check box Enable Automatic
Password Synchronization. Save the changes by clicking OK to close the
dialog box. This second step is necessary because of account delegation
issues with NT.


Using IIS Basic Authentication

1. Refer to the preceding steps if users sign on to IIS using accounts
local to the NT server with IIS when prompted for the user name and
password by the browser.

2. If users sign on by using a domain account and both NT computers for
IIS and SQL Server are in the same domain, ensure that the accounts
have the right "Access This computer from a Network" on the SQL
Server's NT computer, either directly or indirectly, based on the
rights assigned to a group of which the account is a member.


253500 PRB: "Client Unable to Establish Connection" Error Message When
http://support.microsoft.com/?id=253500


316989 PRB: "Login Failed" Error Message When You Create a Trusted Data
http://support.microsoft.com/?id=316989




Thanks,

Kevin McDonnell
Microsoft Corporation

This posting is provided AS IS with no warranties, and confers no rights.


AddThis Social Bookmark Button