编程那点事编程那点事

专注编程入门及提高
探究程序员职业规划之道!

驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接

具体报错如下:

com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]”。
驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]”
The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]

有2个原因

1、jdk高版本​,不推荐使用旧的 TLSV1.0 的协议,所以默认删除 TLS10 的支持

2、服务器上的 SQLServer 版本太低,不支持 TLS13、TLS12,可以通过打补丁的方式解决,不过一般生产环境的话都不建议动服务器

对 Microsoft SQL Server 的 TLS 1.2 支持 - SQL Server | Microsoft Learn

 

最终,我是通过修改 java.security 的方式解决的,在目录 jdk-1.8_371\jdk-1.8\jre\lib\security 下找到 java.security 文件

把 TLSv1 TLSv1.1 和 3DES_EDE_CBC 删除

未经允许不得转载: 技术文章 » 数据库 » 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接