Datagrip连接SQLServer失败

方法一:选择 jTds 驱动程序

image

方法二:降低驱动版本

image

方法三:网上其它乱七八糟的尝试

尝试直接设置连接字符串如下:

jdbc:sqlserver://localhost:1433;DatabaseName=dbname;encrypt=true;trustServerCertificate=true

连接不上的提示
image

断点调试时,报SQLException,com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]”。 ClientConnectionId:237b3165-e4b7-463b-9df7-533bf8facbc8

百度后可能的原因是 jre 的配置,参考如下文档调整:

  1. 找到目标文档 \Eclipse Adoptium\jdk-8.0.352.8-hotspot\jre\lib\security\java.security

  2. 移除 TLSv1, TLSv1.1, 3DES_EDE_CBC
    image

  3. 重启项目

参照
(177条消息) 启动项目,报错:The server selected protocol version TLS10 is not accepted by client preferences [TLS12]解决办法_dangerous317的博客-CSDN博客

posted @ 2023-10-17 17:30  试试手气  阅读(449)  评论(0编辑  收藏  举报