Thursday, March 8, 2012

Connection failed: 18456 error

When one of my users creates an ODBC connection to a SQL database using Windows authentication, he gets this error:

Connection failed: SQLState: '28000' SQL Server Error: 18456
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'Domain\username'

The thing is, the 'Domain\username' is not his username and I have no idea where or why it is trying to use that username.

Ideas?

Hi Mike,

You are using integrated security to your sql connection. You would have to use: Server=yourServer;Database=yourDatabase;User Id=somebody;Password=yourpassword;

Good Coding!

Javier Luna
http://guydotnetxmlwebservices.blogspot.com/

|||

Hi Mike,

If I read your post correctly, your intention is to use Windows auth, correct? If so, then make sure that you use the "Trusted_Connection=Yes" connection string attibute and remote the username and password attibutes. This will make SQL Server authenticate you based on the credentials under which your client application is running.

Further information regarding the 18456 error can be found here: http://blogs.msdn.com/sql_protocols/archive/2006/02/21/536201.aspx

Il-Sung.

|||

I should have been more clear.

He is not doing any coding. We are just manually creating an ODBC data source system DSN using the ODBC Data Source Administrator.

I was just hoping somebody here had run across situation when creating a data source using Windows NT authentication the connection would fail because it was trying to use another username for some odd reason.

|||

I don't have any problems using the ODBC DSN Administrator and integrated auth. Did you make sure that "With Integrated Windows Authentication" was selected on the "How should SQL Server verify the authenticity of the login ID" prompt?

Il-Sung.

|||Sure did, and this is the only person having this issue. It is just so strange that it is trying to use some other username. I wouldnt' be suprised if not very many people have run into this. Bizzare.|||

This is very strange. I tried connecting using integrated auth with both Sql Native Client and MDAC, and in both cases, if I connect with an invalid account, the error message displays the domain name of the actual user. What is the corresponding 18456 error message in the server's error log?

Il-Sung.

No comments:

Post a Comment