idea 中无法连接 sql server 数据库,报错 [08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接

发布时间 2023-10-13 10:52:59作者: Hongweicao

报的错误信息如下:

[08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”。 ClientConnectionId:721941c7-3e08-4e80-bc56-418e1c051624 sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.

查了一些解决办法,都不怎么奏效。原来只需要一个设置就行了,如下图,只需要设置 trustServerCertificate 即可解决问题。