我在 Linux 中的 Java 应用程序尝试访问 MSSQL 数据库但失败。 Keytab、安全登录和 krb5 均已定义。驱动程序是sqljdbc4-2.0.jar
。错误消息仍在寻找 Windows 身份验证。
driver:com.microsoft.sqlserver.jdbc.SQLServerDriver
url:jdbc:sqlserver://AAA.com:10501;instanceName=BBB_DEV;integratedSecurity=true;authenticationScheme=JavaKerberos
Nov 25, 2016 3:42:26 PM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
WARNING: Failed to load the sqljdbc_auth.dll
最佳答案
Microsoft SQL Server JDBC 驱动程序的 2.0 版相当旧,仅在 4.0 版中添加了对纯 Java Kerberos 身份验证的支持。请参阅Using Kerberos Integrated Authentication to Connect to SQL Server :
Beginning in Microsoft JDBC Driver 4.0 for SQL Server, an application can use the authenticationScheme connection property to indicate that it wants to connect to a database using Kerberos integrated authentication using the pure Java Kerberos implementation
要么download version 6.0 from Microsoft ,或者使用
从 Maven 获取版本 6.1<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
关于java - Linux访问MSSQL失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40808598/