koder
koder

Reputation: 35

DriverManager.getConnection(connectionString) - Method threw 'com.microsoft.sqlserver.jdbc.SQLServerException' exception

I am trying to connect to my database using JDBC driver. I have to use my another windows domain credential to connect and getting login failed error. Thought of testing it with my actual windows credential and it worked. I have used integratedSecurity = true.

String connectionUrl = "jdbc:sqlserver://server;databaseName=DB;integratedSecurity=true";

My desired connection string to use my another windows domain credential looks like the below:

 String connectionUrl = "jdbc:sqlserver://server;databaseName=DB;user=domain\\user;password=test!123;"

I did the following things and in need of help:

  1. Placed the sqljdbc_auth inside jdk/bin and jre/bin
  2. SQL Server has been kept under the mixed auth mode (both Windows and SQL Auth).
  3. Using my another domain ID, I tried to execute a query in MS SQL Studio and it worked.

Upvotes: 0

Views: 339

Answers (1)

Andreas
Andreas

Reputation: 159114

Using the Microsoft JDBC driver, you can:

If you want to do a simple NTLM connect using domain, user and password, then you need to use the jTDS JDBC driver.

Upvotes: 2

Related Questions