sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“sun.security.va

项目配置:IDEA使用springboot项目连接sqlserver2019报错,jdk版本为1.7,pom中sqlserver驱动版本为10.2.1.jre8

然而连接sqlserver时报错:

ft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target”

这是我的pom配置


			com.microsoft.sqlserver
			mssql-jdbc
			runtime
		

尝试了各路大神的方法,不论是更换jdk版本,还是所谓的绕过认证的方式(如图1),还是编辑\jdk1.8\jre\lib\security文件夹中的java.security文件去除字符啥的...都没用!sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“sun.security.va_第1张图片

图1

 真正的解决办法:

是sqlserver的驱动版本不对,具体原因不清楚,总之自动配置10.2.1.jre8的驱动版本很容易出错,最后改成了6.2.0.jre8,连接成功。


			com.microsoft.sqlserver
			mssql-jdbc
			6.2.0.jre8
			runtime
		

你可能感兴趣的:(springboot,sqlserver)