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

之后重启即可。

相关推荐
是梦终空12 分钟前
JAVA毕业设计176—基于Java+Springboot+vue3的交通旅游订票管理系统(源代码+数据库)
java·spring boot·vue·毕业设计·课程设计·源代码·交通订票
落落落sss22 分钟前
sharding-jdbc分库分表
android·java·开发语言·数据库·servlet·oracle
码爸25 分钟前
flink doris批量sink
java·前端·flink
Tony聊跨境28 分钟前
什么是 SSL 代理?
网络·网络协议·ssl
Monodye1 小时前
【Java】网络编程:TCP_IP协议详解(IP协议数据报文及如何解决IPv4不够的状况)
java·网络·数据结构·算法·系统架构
一丝晨光1 小时前
逻辑运算符
java·c++·python·kotlin·c#·c·逻辑运算符
无名指的等待7122 小时前
SpringBoot中使用ElasticSearch
java·spring boot·后端
Tatakai252 小时前
Mybatis Plus分页查询返回total为0问题
java·spring·bug·mybatis
武子康2 小时前
大数据-133 - ClickHouse 基础概述 全面了解
java·大数据·分布式·clickhouse·flink·spark
.生产的驴2 小时前
SpringBoot 消息队列RabbitMQ 消费者确认机制 失败重试机制
java·spring boot·分布式·后端·rabbitmq·java-rabbitmq