I have a Java project in Windows with the following Maven config:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>10.2.0.jre8</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc_auth</artifactId>
<version>10.2.0.x64</version>
<type>dll</type>
</dependency>
And the following Hibernate config:
<property name="hibernate.connection.url">
jdbc:sqlserver://localhost;databaseName=<DBNAME>;
integratedSecurity=true;TrustServerCertificate=True;domain=<DOMAIN>
</property>
When running the application with integratedSecurity=false
, everything works. However switching it to true
results in the following errors:
This driver is not configured for integrated authentication
Unable to load authentication DLL
What's going wrong here?
CodePudding user response:
Turns out there's a known bug in the SQL Server JDBC driver where the Maven-provided DLL isn't used when switching to integrated authentication. Instead, JDBC tries to load the same DLL from:
C:\Program Files\Java\jdk-<version>\bin
Copying mssql-jdbc_auth-10.2.0.x64.dll
to that folder resolved the problem and integrated authentication now works. Until Microsoft fixes this bug in their library, this seems to be the only option.