Using jTDS driver with Microsoft SQL Server produces the following error: "Login failed. The login is from an untrusted domain and cannot be used with Windows authentication."
2 years ago
Originally Published: 2016-03-04
Article Number
000063219
Applies To
RSA Identity Management and Governance (IMG)
Issue
When testing a connection to Microsoft SQL Server (MSSQL) using the jTDS driver, you may get the following error in the Java stack trace:
 
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.



 
Cause
To work around this issue, you need to enable NTLMv2 support in the jTDS driver. The error message is misleading because it implies that MSSQL is using Windows Integrated Authentication even if you are using SQL Authentication.
Resolution
Append the following to your URL connection string to enable NTLMv2 in the jTDS driver:
 
;useNTLMv2=TRUE

Your final connection string should resemble the following:
 
jdbc:jtds:sqlserver://sqlserver.domain.corp:1433/MyDatabase;useNTLMv2=TRUE