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].. ....
6条答案
按热度按时间yv5phkfx1#
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://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15You 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.aiazj4mn2#
I had this same problem, and it took me hours to figure out.
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.5n0oy7gb3#
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.
sqljdbc_<version>_enu.zip
from https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15 as per you Java version.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/libmqxuamgl4#
In order to be able to connect with the JDBC, you need to define the connection as follows:
Use the following dependency:
bttbmeg05#
You should delete maven dependency:
Then: add dependency JDBC driver jar manually download here
This is worked for me.
ut6juiuv6#
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.