Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

com.microsoft.sqlserver.jdbc.SQLServerException Login failed for user '' ..

795658Jan 6 2010 — edited Jan 18 2010
Hi All,

I have the following weird problem when trying to connect to MSSQL 2005 database using JDBC and windows authentication.

I am using the following command:
DriverManager.getConnection("jdbc:sqlserver://<<MACHINE IP>>:;database=<<DB NAME>>;integratedSecurity=true;","<<DOMAIN USER NAME>>","<<DOMAIN USER PASSWORD>>")
and I get the following exception:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

I tried to google this exception but all I can see is similar one but the exception also contain the user name. Please note that in the exception I get, the user name is not listed..

I also checked it with various connection strings (I also tried to put the user name and password in the connection string, using the parameters 'user' and 'password'), but I always get the same result.

Also, when I used SQL authentication I am able to connect to the SQL (after I remove the 'integratedSecurity' param).
The SQL server is configured to work with both SQL and Windows authentication- I am able to log in to the SQL (with Microsoft SQL server management studio express) with the same windows user.

The sqljdbc_auth.dll is also located in the class path.

Does anyone have any idea what I am doing wrong?

Thanks,
Uri
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2010
Added on Jan 6 2010
9 comments
1,704 views