How to Connect to MS SQL Server via Windows Authentication
Reported for version 10
The Error
When trying to connect to MS SQL Server, users get a similar error to the following:
java.rmi.RemoteException: Unable to connect to the database ; nested exception is: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'test\user'. ClientConnectionId:09481835-dd8f-404a-b45d-ce84888ab0bc at com.ataccama.dqc.gui.model.internal.database.DBDatabaseImpl.connect(y:533) at com.ataccama.dqc.gui.ui.navigator.actions.database.DatabaseConnectionAdapter.connect(y:2814) at com.ataccama.dqc.gui.ui.navigator.actions.connection.ConnectOperation.execute(y:1202) at com.ataccama.dqc.gui.ui.navigator.actions.connection.OperationConnectionAction$1.run(y:1877) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'test\user'. ClientConnectionId:09481835-dd8f-404a-b45d-ce84888ab0bc at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217) at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:251) at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:81) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:3077) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2360) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2346) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1404) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1068) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:904) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:451) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1014) at com.ataccama.dqc.commons.sql.util.SimpleDataSource.getConnection(SimpleDataSource.java:87) at com.ataccama.dqc.commons.sql.util.SimpleDataSource.getConnection(SimpleDataSource.java:71) at com.ataccama.dqc.internal.commons.sql.ConnectionCreator.createResource(ConnectionCreator.java:36) at com.ataccama.dqc.internal.commons.sql.ConnectionCreator.createResource(ConnectionCreator.java:24) at com.ataccama.dqc.commons.resourcepool.ResourcesPool.createResource(ResourcesPool.java:110) at com.ataccama.dqc.commons.resourcepool.ResourcesPool.createResources(ResourcesPool.java:241) at com.ataccama.dqc.commons.resourcepool.ResourceCreatorTask.run(ResourceCreatorTask.java:21) at java.lang.Thread.run(Unknown Source)
Solution
There are two ways to solve the issue, using two different drivers:
Connect via the JDBC driver:
Right-click Databases in the File Explorer and select New Database Connection. In the dialogue window, select MS SQL in the Database type field.
Add
integratedSecurity=true
to the end of the connection string. For example:jdbc:sqlserver://localhost:1433;databaseName=test1;integratedSecurity=true
Connect via the jTDS driver:
Right-click Databases in the File Explorer and select New Database Connection. In the dialogue window, select jTDS - MS SQL in the Database type field.
- Set the connection parameter to By URL.
Specify a connection string in the following format.
jdbc:jtds:sqlserver://localhost:9876/test1;domain=company
- fill in the Username and Password.
Related articles