JDBC集成认证连接SQL Server

下载JDBC Driver

目前最新版本是v9.4
值得一提的是从v6.4开始,连接字符串增加属性SSLProtocol,可以指定TLS版本(https://github.com/Microsoft/mssql-jdbc/wiki/SSLProtocol)
https://docs.microsoft.com/en-us/sql/connect/jdbc/release-notes-for-the-jdbc-driver?view=sql-server-ver15

连接字符串

jdbc:sqlserver://HOSTNAME;integratedSecurity=true;database=DATABASE;

sqljdbc_auth.dll文件

将下载的JDBC driver文件夹中的sqljdbc_auth.dll文件copy到windows路径下,比如system32,或者java\jdk\jre\bin目录下

driver目录如下:

参考

https://docs.microsoft.com/en-us/previous-versions/sql/legacy/ms378428(v=sql.90)?redirectedfrom=MSDN#connecting-with-integrated-authentication

原文地址:https://www.cnblogs.com/talentzemin/p/15762409.html