'no mssql-jdbc_auth-8.2.1.x64 in java.library.path
I'm trying to connect to SQL DB in my Maven project, but keep getting following exception:
"com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ...", "..Caused by: java.lang.UnsatisfiedLinkError: no mssql-jdbc_auth-8.2.1.x64 in java.library.path....".
I've tried out suggestions from no sqljdbc_auth in java.library.path and UnsatisfiedLinkError: no sqljdbc_auth in java.library.path but it didn't work for me.
I've put the path to sqljdbc_auth.dll in:
Global PATH variable Global PATH variable screenshot
C:\Program Files\Java\jdk-13.0.2\bin C:\Program Files\Java\jdk-13.0.2\bin screenshot
pom.xml (as a configuration in surefire plugin dependency) pom.xml screenshot
And here is my code:
public class JDBC {
@Test
public void test() throws SQLException, ClassNotFoundException {
String UserName="sa";
String Password="Error911";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String DB_URL ="jdbc:sqlserver://localhost:1433;databaseName=QADB;integratedSecurity=true;";
//OR by using ip
//DB_URL ="jdbc:sqlserver://192.168.0.104;databaseName=QADB;integratedSecurity=true;";
Connection con = DriverManager.getConnection(DB_URL, UserName, Password);
}
}
And the exception in console output:
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication...........................
...Caused by: java.lang.UnsatisfiedLinkError: no mssql-jdbc_auth-8.2.1.x64 in java.library.path: [C:\Users\Automation\Microsoft JDBC Driver 6.0 for SQL Server\sqljdbc_6.0\enu\auth\x64].. ....
Solution 1:[1]
it seems that you don't have the mssql-jdbc_auth-8.2.1.x64
file in your classpath.
As far as I know that file is included in the Microsoft SQL JDBC driver (enu/auth/x64
folder): https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15
You can add that file to your classpath (for example copy it to: C:\Program Files\Java\jdk-13.0.2\bin
) and fix the error.
Solution 2:[2]
I had this same problem, and it took me hours to figure out.
Make sure that you're copying the
mssql-jdbc_auth-8.2.1.x64
file and not thesqljdbc_xa.dll
file into theC:\Program Files\Java\jdk-13.0.2\bin folder
. According to the screenshot of your bin folder, I don't think this is the issue.Restart Eclipse and run it again. I was copying the file into the bin folder with eclipse running and I had no success. Only after I restarted eclipse did the driver begin to work correctly.
Solution 3:[3]
Just follow below steps and it will surely turn out to fix "no mssql-jdbc_auth-8.2.1.x64 in java.library.path" as well as "JDBC SQLServerException: “This driver is not configured for integrated authentication" issue.
Download
sqljdbc_<version>_enu.zip
from https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15 as per you Java version.Unzip it, read install.txt and do as it says
Paste
mssql-jdbc_auth-8.2.2.x64.dll
(present inside path -> C:/Program Files/Microsoft JDBC DRIVER 8.2 for SQL Server/sqljdbc_/enu/auth/x64 to Java/jre8/bin and to Java/jre8/lib
Solution 4:[4]
You should delete maven dependency :
dependency>
groupId>com.microsoft.sqlserver</groupId
artifactId>mssql-jdbc /artifactId>
/dependency>
then :
add dependency jdbc driver jar manually (download here:
https://docs.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15 )
This is worked for me.
Solution 5:[5]
In order to be able to connect with the JDBC, you need to define the connection as follows:
"jdbc:sqlserver://*******;authenticationScheme=NTLM;integratedSecurity=true;domain=******;databasename=**********;encrypt=true;trustServerCertificate=true;user=*******;password=*******;"
Use the following dependency:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>10.2.0.jre8</version>
</dependency>
Solution 6:[6]
I also had the same issue, and i also went through the posts that you mentioned, i resolved it by adding the mssql-jdbc_auth-8.2.2.x64.dll in \java\jre\bin\ instead of \java\bin. I was using a JDK and not a JRE.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | matteogll |
Solution 2 | Math chiller |
Solution 3 | dippas |
Solution 4 | Emre Eser |
Solution 5 | Eyal Sooliman |
Solution 6 | Dharman |