springboot中,连接sql server数据库报错如下?
不修改服务器的java.security情况下,如何仅仅通过代码层面的修改(修改连接,加参数等)解决报错问题?
在公司,我无权做服务器的修改,仅能修改代码
package com.suiwei.frame;import java.sql.*;
public class DatabaseConnection {
public static void main(String[] args) {
// 定义连接信息
String url = "jdbc:sqlserver://10.10.10.10:1433;databaseName=demo";
String username = "12345";
String password = "12345";
// 创建连接
try (Connection conn = DriverManager.getConnection(url, username, password)) {
System.out.println("成功连接到 MySQL 数据库!");
// 执行查询
Statement statement = conn.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM stoptime limit 500");
// 输出结果
while (resultSet.next()) {
String id = resultSet.getString("id");
System.out.println(id);
}
} catch (SQLException e) {
System.out.println("连接 MySQL 数据库失败!");
e.printStackTrace();
}
}
}
报错如下
"C:\Program Files\Java\jdk1.8.0_201\bin\java.exe" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\lib\idea_rt.jar=8553:C:\Program Files\JetBrains\IntelliJ IDEA 2022.3.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_201\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_201\jre\lib\rt.jar;D:\demo\springbootDemo\target\test-classes;D:\demo\springbootDemo\target\classes;D:\maven\repository\org\springframework\boot\spring-boot-starter-web\2.3.7.RELEASE\spring-boot-starter-web-2.3.7.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter\2.3.7.RELEASE\spring-boot-starter-2.3.7.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-logging\2.3.7.RELEASE\spring-boot-starter-logging-2.3.7.RELEASE.jar;D:\maven\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\maven\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\maven\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\maven\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\maven\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\maven\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\maven\repository\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-json\2.3.7.RELEASE\spring-boot-starter-json-2.3.7.RELEASE.jar;D:\maven\repository\com\fasterxml\jackson\core\jackson-databind\2.11.3\jackson-databind-2.11.3.jar;D:\maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.3\jackson-annotations-2.11.3.jar;D:\maven\repository\com\fasterxml\jackson\core\jackson-core\2.11.3\jackson-core-2.11.3.jar;D:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.3\jackson-datatype-jdk8-2.11.3.jar;D:\maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.3\jackson-datatype-jsr310-2.11.3.jar;D:\maven\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.3\jackson-module-parameter-names-2.11.3.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-tomcat\2.3.7.RELEASE\spring-boot-starter-tomcat-2.3.7.RELEASE.jar;D:\maven\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.41\tomcat-embed-core-9.0.41.jar;D:\maven\repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\maven\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.41\tomcat-embed-websocket-9.0.41.jar;D:\maven\repository\org\springframework\spring-web\5.2.12.RELEASE\spring-web-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-beans\5.2.12.RELEASE\spring-beans-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-webmvc\5.2.12.RELEASE\spring-webmvc-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-aop\5.2.12.RELEASE\spring-aop-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-context\5.2.12.RELEASE\spring-context-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-expression\5.2.12.RELEASE\spring-expression-5.2.12.RELEASE.jar;D:\maven\repository\com\alibaba\fastjson\1.2.83\fastjson-1.2.83.jar;D:\maven\repository\org\projectlombok\lombok\1.18.16\lombok-1.18.16.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-test\2.3.7.RELEASE\spring-boot-starter-test-2.3.7.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-test\2.3.7.RELEASE\spring-boot-test-2.3.7.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-test-autoconfigure\2.3.7.RELEASE\spring-boot-test-autoconfigure-2.3.7.RELEASE.jar;D:\maven\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;D:\maven\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;D:\maven\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;D:\maven\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.3\jakarta.xml.bind-api-2.3.3.jar;D:\maven\repository\jakarta\activation\jakarta.activation-api\1.2.2\jakarta.activation-api-1.2.2.jar;D:\maven\repository\org\assertj\assertj-core\3.16.1\assertj-core-3.16.1.jar;D:\maven\repository\org\hamcrest\hamcrest\2.2\hamcrest-2.2.jar;D:\maven\repository\org\junit\jupiter\junit-jupiter\5.6.3\junit-jupiter-5.6.3.jar;D:\maven\repository\org\junit\jupiter\junit-jupiter-api\5.6.3\junit-jupiter-api-5.6.3.jar;D:\maven\repository\org\apiguardian\apiguardian-api\1.1.0\apiguardian-api-1.1.0.jar;D:\maven\repository\org\opentest4j\opentest4j\1.2.0\opentest4j-1.2.0.jar;D:\maven\repository\org\junit\platform\junit-platform-commons\1.6.3\junit-platform-commons-1.6.3.jar;D:\maven\repository\org\junit\jupiter\junit-jupiter-params\5.6.3\junit-jupiter-params-5.6.3.jar;D:\maven\repository\org\junit\jupiter\junit-jupiter-engine\5.6.3\junit-jupiter-engine-5.6.3.jar;D:\maven\repository\org\junit\platform\junit-platform-engine\1.6.3\junit-platform-engine-1.6.3.jar;D:\maven\repository\org\mockito\mockito-core\3.3.3\mockito-core-3.3.3.jar;D:\maven\repository\net\bytebuddy\byte-buddy\1.10.18\byte-buddy-1.10.18.jar;D:\maven\repository\net\bytebuddy\byte-buddy-agent\1.10.18\byte-buddy-agent-1.10.18.jar;D:\maven\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;D:\maven\repository\org\mockito\mockito-junit-jupiter\3.3.3\mockito-junit-jupiter-3.3.3.jar;D:\maven\repository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;D:\maven\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;D:\maven\repository\org\springframework\spring-core\5.2.12.RELEASE\spring-core-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-jcl\5.2.12.RELEASE\spring-jcl-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-test\5.2.12.RELEASE\spring-test-5.2.12.RELEASE.jar;D:\maven\repository\org\xmlunit\xmlunit-core\2.7.0\xmlunit-core-2.7.0.jar;D:\maven\repository\org\springframework\boot\spring-boot-devtools\2.3.7.RELEASE\spring-boot-devtools-2.3.7.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot\2.3.7.RELEASE\spring-boot-2.3.7.RELEASE.jar;D:\maven\repository\org\springframework\boot\spring-boot-autoconfigure\2.3.7.RELEASE\spring-boot-autoconfigure-2.3.7.RELEASE.jar;D:\maven\repository\com\baomidou\mybatis-plus-boot-starter\3.4.3\mybatis-plus-boot-starter-3.4.3.jar;D:\maven\repository\com\baomidou\mybatis-plus\3.4.3\mybatis-plus-3.4.3.jar;D:\maven\repository\com\baomidou\mybatis-plus-extension\3.4.3\mybatis-plus-extension-3.4.3.jar;D:\maven\repository\com\baomidou\mybatis-plus-core\3.4.3\mybatis-plus-core-3.4.3.jar;D:\maven\repository\com\baomidou\mybatis-plus-annotation\3.4.3\mybatis-plus-annotation-3.4.3.jar;D:\maven\repository\com\github\jsqlparser\jsqlparser\4.0\jsqlparser-4.0.jar;D:\maven\repository\org\mybatis\mybatis\3.5.7\mybatis-3.5.7.jar;D:\maven\repository\org\mybatis\mybatis-spring\2.0.6\mybatis-spring-2.0.6.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-jdbc\2.3.7.RELEASE\spring-boot-starter-jdbc-2.3.7.RELEASE.jar;D:\maven\repository\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;D:\maven\repository\org\springframework\spring-jdbc\5.2.12.RELEASE\spring-jdbc-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\spring-tx\5.2.12.RELEASE\spring-tx-5.2.12.RELEASE.jar;D:\maven\repository\mysql\mysql-connector-java\8.0.22\mysql-connector-java-8.0.22.jar;D:\maven\repository\com\microsoft\sqlserver\mssql-jdbc\10.2.3.jre8\mssql-jdbc-10.2.3.jre8.jar;D:\maven\repository\com\alibaba\druid-spring-boot-starter\1.2.6\druid-spring-boot-starter-1.2.6.jar;D:\maven\repository\com\alibaba\druid\1.2.6\druid-1.2.6.jar;D:\maven\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\maven\repository\org\quartz-scheduler\quartz\2.3.2\quartz-2.3.2.jar;D:\maven\repository\com\mchange\mchange-commons-java\0.2.15\mchange-commons-java-0.2.15.jar;D:\maven\repository\org\apache\commons\commons-lang3\3.10\commons-lang3-3.10.jar;D:\maven\repository\org\apache\commons\commons-collections4\4.2\commons-collections4-4.2.jar;D:\maven\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar;D:\maven\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;D:\maven\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-web-services\2.3.7.RELEASE\spring-boot-starter-web-services-2.3.7.RELEASE.jar;D:\maven\repository\com\sun\xml\messaging\saaj\saaj-impl\1.5.2\saaj-impl-1.5.2.jar;D:\maven\repository\jakarta\xml\soap\jakarta.xml.soap-api\1.4.2\jakarta.xml.soap-api-1.4.2.jar;D:\maven\repository\org\jvnet\staxex\stax-ex\1.8.3\stax-ex-1.8.3.jar;D:\maven\repository\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;D:\maven\repository\jakarta\xml\ws\jakarta.xml.ws-api\2.3.3\jakarta.xml.ws-api-2.3.3.jar;D:\maven\repository\jakarta\jws\jakarta.jws-api\2.1.0\jakarta.jws-api-2.1.0.jar;D:\maven\repository\org\springframework\spring-oxm\5.2.12.RELEASE\spring-oxm-5.2.12.RELEASE.jar;D:\maven\repository\org\springframework\ws\spring-ws-core\3.0.10.RELEASE\spring-ws-core-3.0.10.RELEASE.jar;D:\maven\repository\org\springframework\ws\spring-xml\3.0.10.RELEASE\spring-xml-3.0.10.RELEASE.jar;D:\maven\repository\org\apache\cxf\cxf-spring-boot-starter-jaxws\3.4.3\cxf-spring-boot-starter-jaxws-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-spring-boot-autoconfigure\3.4.3\cxf-spring-boot-autoconfigure-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-transports-http\3.4.3\cxf-rt-transports-http-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-frontend-jaxws\3.4.3\cxf-rt-frontend-jaxws-3.4.3.jar;D:\maven\repository\xml-resolver\xml-resolver\1.2\xml-resolver-1.2.jar;D:\maven\repository\org\ow2\asm\asm\9.1\asm-9.1.jar;D:\maven\repository\org\apache\cxf\cxf-rt-bindings-soap\3.4.3\cxf-rt-bindings-soap-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-wsdl\3.4.3\cxf-rt-wsdl-3.4.3.jar;D:\maven\repository\wsdl4j\wsdl4j\1.6.3\wsdl4j-1.6.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-databinding-jaxb\3.4.3\cxf-rt-databinding-jaxb-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-bindings-xml\3.4.3\cxf-rt-bindings-xml-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-frontend-simple\3.4.3\cxf-rt-frontend-simple-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-ws-addr\3.4.3\cxf-rt-ws-addr-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-rt-ws-policy\3.4.3\cxf-rt-ws-policy-3.4.3.jar;D:\maven\repository\org\apache\neethi\neethi\3.1.1\neethi-3.1.1.jar;D:\maven\repository\org\apache\cxf\cxf-rt-features-metrics\3.4.3\cxf-rt-features-metrics-3.4.3.jar;D:\maven\repository\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;D:\maven\repository\org\springframework\boot\spring-boot-starter-validation\2.3.7.RELEASE\spring-boot-starter-validation-2.3.7.RELEASE.jar;D:\maven\repository\org\hibernate\validator\hibernate-validator\6.1.6.Final\hibernate-validator-6.1.6.Final.jar;D:\maven\repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;D:\maven\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;D:\maven\repository\org\apache\cxf\cxf-rt-transports-http-jetty\3.4.3\cxf-rt-transports-http-jetty-3.4.3.jar;D:\maven\repository\org\apache\cxf\cxf-core\3.4.3\cxf-core-3.4.3.jar;D:\maven\repository\org\glassfish\jaxb\jaxb-runtime\2.3.3\jaxb-runtime-2.3.3.jar;D:\maven\repository\org\glassfish\jaxb\txw2\2.3.3\txw2-2.3.3.jar;D:\maven\repository\com\sun\istack\istack-commons-runtime\3.0.11\istack-commons-runtime-3.0.11.jar;D:\maven\repository\com\fasterxml\woodstox\woodstox-core\6.2.4\woodstox-core-6.2.4.jar;D:\maven\repository\org\codehaus\woodstox\stax2-api\4.2.1\stax2-api-4.2.1.jar;D:\maven\repository\org\apache\ws\xmlschema\xmlschema-core\2.2.5\xmlschema-core-2.2.5.jar;D:\maven\repository\org\eclipse\jetty\jetty-server\9.4.35.v20201120\jetty-server-9.4.35.v20201120.jar;D:\maven\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;D:\maven\repository\org\eclipse\jetty\jetty-util\9.4.35.v20201120\jetty-util-9.4.35.v20201120.jar;D:\maven\repository\org\eclipse\jetty\jetty-io\9.4.35.v20201120\jetty-io-9.4.35.v20201120.jar;D:\maven\repository\org\eclipse\jetty\jetty-security\9.4.35.v20201120\jetty-security-9.4.35.v20201120.jar;D:\maven\repository\org\eclipse\jetty\jetty-continuation\9.4.35.v20201120\jetty-continuation-9.4.35.v20201120.jar;D:\maven\repository\org\eclipse\jetty\jetty-http\9.4.35.v20201120\jetty-http-9.4.35.v20201120.jar;D:\maven\repository\org\springframework\boot\spring-boot-configuration-processor\2.3.7.RELEASE\spring-boot-configuration-processor-2.3.7.RELEASE.jar" com.suiwei.frame.DatabaseConnection连接 MySQL 数据库失败!
com.microsoft.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”。 ClientConnectionId:9bea5f22-eac2-4047-af5a-16ef9a39363f
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:3680)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:2047)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:3204)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2833)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:2671)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1640)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:936)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.suiwei.frame.DatabaseConnection.main(DatabaseConnection.java:14)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1639)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1955)
... 8 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
at sun.security.validator.Validator.validate(Validator.java:262)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:105)
at com.microsoft.sqlserver.jdbc.TDSChannel$HostNameOverrideX509TrustManager.checkServerTrusted(IOBuffer.java:1636)
at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:1091)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1621)
... 16 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
... 24 more
Process finished with exit code 0
回答:
解决驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接
回答:
之前遇到
+jdbc:sqlserver://10.10.10.10:1433;databaseName=demo;encrypt=true;trustServerCertificate=true-jdbc:sqlserver://10.10.10.10:1433;databaseName=demo
<dependency> <groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>12.2.0.jre8</version>
</dependency>
以上是 springboot中,连接sql server数据库报错如下? 的全部内容, 来源链接: utcz.com/p/945220.html