Connecting to MS SQL Server using Windows authentication and JTDS
-
19-10-2022 - |
Question
I am unable to connect to SQL Server using Windows Authentification. This is is the exception being thrown:
Caused by: java.io.IOException: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
at net.sourceforge.jtds.jdbc.TdsCore.sendMSLoginPkt(TdsCore.java:1889)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:587)
... 35 more
Here is the Spring configuration:
@Bean
public DataSource dataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("net.sourceforge.jtds.jdbc.Driver");
dataSource.setUrl(...);
return dataSource;
}
The following VM argument is defined:
-Djava.library.path=C:\x64\SSO
This points to ntlmauth.dll (from jtds-1.3.1-dist.zip)
The following dependency is defined in the pom:
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>com.springsource.net.sourceforge.jtds</artifactId>
<version>1.2.2</version>
</dependency>
Have obviously omitted something - any help is very appreciated!
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow