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!

Can Connect to SQLServer as SA, but not another user

843859Aug 23 2008 — edited Aug 23 2008
I configured my SQL Server (2005) to do dual authentication. I can connect to my database using MS SQL Server Management Studio both as SA and my other login (Custcompass). In my java program, I can also connect as SA, but I can't connect as my other login. I'm using a jdbc driver I downloaded from Microsoft. Here's the code:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

//Fails with SQLState=S0001, vendorCode=18456, detailMessage="Login failed for user 'Custcompass'." 

String connectionUrl = "jdbc:sqlserver://localhost:1434;databaseName=custCompass;user=Custcompass;password=xyz;";
Connection con = DriverManager.getConnection(connectionUrl);

//Works

String connectionUrl = "jdbc:sqlserver://localhost:1434;databaseName=custCompass;user=sa;password=abc;";
Connection con = DriverManager.getConnection(connectionUrl);
I'm new to use SQLServer from java, so it could be something stupid on my part. Any ideas?
Thanks.
Steve
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2008
Added on Aug 23 2008
3 comments
175 views