驱动程序无法通过使用安全套接字层(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删除,修改后为:

之后重启即可。

相关推荐
lifallen几秒前
Paimon vs. HBase:全链路开销对比
java·大数据·数据结构·数据库·算法·flink·hbase
m0_6948455710 分钟前
服务器如何配置防火墙规则开放/关闭端口?
linux·服务器·安全·云计算
深栈解码40 分钟前
JMM深度解析(三) volatile实现机制详解
java·后端
liujing102329291 小时前
Day04_刷题niuke20250703
java·开发语言·算法
Brookty1 小时前
【MySQL】JDBC编程
java·数据库·后端·学习·mysql·jdbc
能工智人小辰1 小时前
二刷 苍穹外卖day10(含bug修改)
java·开发语言
DKPT1 小时前
Java设计模式之结构型模式(外观模式)介绍与说明
java·开发语言·笔记·学习·设计模式
缘来是庄1 小时前
设计模式之外观模式
java·设计模式·外观模式
知其然亦知其所以然2 小时前
JVM社招面试题:队列和栈是什么?有什么区别?我在面试现场讲了个故事…
java·后端·面试
harmful_sheep2 小时前
Spring 为何需要三级缓存解决循环依赖,而不是二级缓存
java·spring·缓存