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

[08S01] 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”。 ClientConnectionId:01fb22ee-a11e-4186-badc-85a12242d1e4
unable to find valid certification path to requested target.

解决方法

在url链接后面encrypt=true;trustServerCertificate=true

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