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

报错信息:

shell 复制代码
D:\self_need_path_files\JDK_8\bin\java.exe "-javaagent:E:\Code_Tool\IDEA\IntelliJ IDEA 2023.1.4\lib\idea_rt.jar=50748:E:\Code_Tool\IDEA\IntelliJ IDEA 2023.1.4\bin" -Dfile.encoding=UTF-8 -classpath D:\self_need_path_files\JDK_8\jre\lib\charsets.jar;D:\self_need_path_files\JDK_8\jre\lib\deploy.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\access-bridge-64.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\cldrdata.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\dnsns.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\jaccess.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\jfxrt.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\localedata.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\nashorn.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\sunec.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\sunjce_provider.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\sunmscapi.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\sunpkcs11.jar;D:\self_need_path_files\JDK_8\jre\lib\ext\zipfs.jar;D:\self_need_path_files\JDK_8\jre\lib\javaws.jar;D:\self_need_path_files\JDK_8\jre\lib\jce.jar;D:\self_need_path_files\JDK_8\jre\lib\jfr.jar;D:\self_need_path_files\JDK_8\jre\lib\jfxswt.jar;D:\self_need_path_files\JDK_8\jre\lib\jsse.jar;D:\self_need_path_files\JDK_8\jre\lib\management-agent.jar;D:\self_need_path_files\JDK_8\jre\lib\plugin.jar;D:\self_need_path_files\JDK_8\jre\lib\resources.jar;D:\self_need_path_files\JDK_8\jre\lib\rt.jar;E:\Undergraduate\School\Courses\大三下\Web程序设计\webapp\demo\out\production\demo;E:\Database_Tool\SQLEXPRADV_x64_CHS\sqljdbc4.jar SqlServerTest
四月 01, 2024 1:33:23 下午 com.microsoft.sqlserver.jdbc.TDSChannel enableSSL
信息: java.security path: D:\self_need_path_files\JDK_8\jre\lib\security
Security providers: [SUN version 1.8, SunRsaSign version 1.8, SunEC version 1.8, SunJSSE version 1.8, SunJCE version 1.8, SunJGSS version 1.8, SunSASL version 1.8, XMLDSig version 1.8, SunPCSC version 1.8, SunMSCAPI version 1.8]
SSLContext provider info: Sun JSSE provider(PKCS12, SunX509/PKIX key/trust factories, SSLv3/TLSv1/TLSv1.1/TLSv1.2/TLSv1.3)
SSLContext provider services:
[SunJSSE: KeyPairGenerator.RSA -> sun.security.rsa.RSAKeyPairGenerator$Legacy
  aliases: [OID.1.2.840.113549.1.1, 1.2.840.113549.1.1, 1.2.840.113549.1.1.1]
, SunJSSE: KeyFactory.RSA -> sun.security.rsa.RSAKeyFactory$Legacy
  aliases: [OID.1.2.840.113549.1.1, 1.2.840.113549.1.1, 1.2.840.113549.1.1.1]
, SunJSSE: Signature.SHA1withRSA -> sun.security.rsa.RSASignature$SHA1withRSA
  aliases: [OID.1.2.840.113549.1.1.5, 1.2.840.113549.1.1.5, 1.3.14.3.2.29]
  attributes: {SupportedKeyClasses=java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey}
, SunJSSE: SSLContext.TLS -> sun.security.ssl.SSLContextImpl$TLSContext
  aliases: [SSL]
, SunJSSE: SSLContext.TLSv1 -> sun.security.ssl.SSLContextImpl$TLS10Context
  aliases: [SSLv3]
, SunJSSE: Signature.MD2withRSA -> sun.security.rsa.RSASignature$MD2withRSA
  aliases: [OID.1.2.840.113549.1.1.2, 1.2.840.113549.1.1.2]
  attributes: {SupportedKeyClasses=java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey}
, SunJSSE: Signature.MD5withRSA -> sun.security.rsa.RSASignature$MD5withRSA
  aliases: [OID.1.2.840.113549.1.1.4, 1.2.840.113549.1.1.4]
  attributes: {SupportedKeyClasses=java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey}
, SunJSSE: KeyStore.PKCS12 -> sun.security.pkcs12.PKCS12KeyStore
, SunJSSE: TrustManagerFactory.SunX509 -> sun.security.ssl.TrustManagerFactoryImpl$SimpleFactory
, SunJSSE: KeyManagerFactory.SunX509 -> sun.security.ssl.KeyManagerFactoryImpl$SunX509
, SunJSSE: TrustManagerFactory.PKIX -> sun.security.ssl.TrustManagerFactoryImpl$PKIXFactory
  aliases: [SunPKIX, X509, X.509]
, SunJSSE: KeyManagerFactory.NewSunX509 -> sun.security.ssl.KeyManagerFactoryImpl$X509
  aliases: [PKIX]
, SunJSSE: SSLContext.Default -> sun.security.ssl.SSLContextImpl$DefaultSSLContext
, SunJSSE: SSLContext.TLSv1.1 -> sun.security.ssl.SSLContextImpl$TLS11Context
, SunJSSE: Signature.MD5andSHA1withRSA -> sun.security.ssl.RSASignature
, SunJSSE: SSLContext.TLSv1.3 -> sun.security.ssl.SSLContextImpl$TLS13Context
, SunJSSE: SSLContext.TLSv1.2 -> sun.security.ssl.SSLContextImpl$TLS12Context
]
java.ext.dirs: D:\self_need_path_files\JDK_8\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
Exception in thread "main" com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:"The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]"。 ClientConnectionId:75cdc2ce-971c-450f-b033-546325121f42
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667)
	at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1668)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1323)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:247)
	at SqlServerTest.main(SqlServerTest.java:18)
Caused by: javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]
	at sun.security.ssl.Alert.createSSLException(Alert.java:131)
	at sun.security.ssl.Alert.createSSLException(Alert.java:117)
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:364)
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:320)
	at sun.security.ssl.TransportContext.fatal(TransportContext.java:311)
	at sun.security.ssl.ServerHello$ServerHelloConsumer.onServerHello(ServerHello.java:941)
	at sun.security.ssl.ServerHello$ServerHelloConsumer.consume(ServerHello.java:868)
	at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:376)
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:479)
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:457)
	at sun.security.ssl.TransportContext.dispatch(TransportContext.java:200)
	at sun.security.ssl.SSLTransport.decode(SSLTransport.java:155)
	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1320)
	at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1233)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:417)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:389)
	at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1618)
	... 7 more

进程已结束,退出代码1

TLSv1TLSv1.1删除,修改后为:

之后重启即可。

相关推荐
程序媛-徐师姐1 分钟前
Java 基于SpringBoot+vue框架的老年医疗保健网站
java·vue.js·spring boot·老年医疗保健·老年 医疗保健
yngsqq2 分钟前
c#使用高版本8.0步骤
java·前端·c#
尘浮生12 分钟前
Java项目实战II基于微信小程序的校运会管理系统(开发文档+数据库+源码)
java·开发语言·数据库·微信小程序·小程序·maven·intellij-idea
小白不太白95016 分钟前
设计模式之 模板方法模式
java·设计模式·模板方法模式
Tech Synapse18 分钟前
Java根据前端返回的字段名进行查询数据的方法
java·开发语言·后端
xoxo-Rachel25 分钟前
(超级详细!!!)解决“com.mysql.jdbc.Driver is deprecated”警告:详解与优化
java·数据库·mysql
乌啼霜满天24926 分钟前
JDBC编程---Java
java·开发语言·sql
色空大师39 分钟前
23种设计模式
java·开发语言·设计模式
闲人一枚(学习中)40 分钟前
设计模式-创建型-建造者模式
java·设计模式·建造者模式