The driver cannot establish a secure connection exception resolution by using Secure Sockets Layer (SSL) encryption with SQL Server

Source: Internet
Author: User
Tags aliases pkcs12

Reprint: http://m.educity.cn/wenda/584424.html

The driver cannot establish a secure connection error resolution with SQL Server by using Secure Sockets Layer (SSL) encryption

The following error always occurs when connecting sqlserver2005 with Java

June, 10:05:34 AM com.microsoft.sqlserver.jdbc.TDSChannel Enablessl
Information: java.security path:c:\java\jre6\lib\security
Security providers: [SUN version 1.6, sunrsasign version 1.5, Sunjsse version 1.6, SUNJGSS version 1.0, SUNSASL version 1. 5, XMLDSig version 1.0, SUNPCSC version 1.6]
Sslcontext provider Info:sun JSSE provider (PKCS12, SunX509 key/trust factories, SSLv3, TLSV1)
Sslcontext Provider Services:
[SunJSSE:KeyFactory.RSA-Sun.security.rsa.RSAKeyFactory
Aliases: [1.2.840.113549.1.1, oid.1.2.840.113549.1.1]
, SunJSSE:KeyPairGenerator.RSA-Sun.security.rsa.RSAKeyPairGenerator
Aliases: [1.2.840.113549.1.1, oid.1.2.840.113549.1.1]
, SunJSSE:Signature.MD2withRSA-Sun.security.rsa.rsasignature$md2withrsa
Aliases: [1.2.840.113549.1.1.2, oid.1.2.840.113549.1.1.2]
, SunJSSE:Signature.MD5withRSA-Sun.security.rsa.rsasignature$md5withrsa
Aliases: [1.2.840.113549.1.1.4, oid.1.2.840.113549.1.1.4]
, SunJSSE:Signature.SHA1withRSA-Sun.security.rsa.rsasignature$sha1withrsa
Aliases: [1.2.840.113549.1.1.5, oid.1.2.840.113549.1.1.5, 1.3.14.3.2.29, oid.1.3.14.3.2.29]
, SunJSSE:Signature.MD5andSHA1withRSA-Co.ssl.internal.ssl.RSASignature
, SunJSSE:KeyManagerFactory.SunX509-co.ssl.internal.ssl.keymanagerfactoryimpl$sunx509
, SunJSSE:KeyManagerFactory.NewSunX509-co.ssl.internal.ssl.keymanagerfactoryimpl$x509
, SunJSSE:TrustManagerFactory.SunX509-Co.ssl.internal.ssl.trustmanagerfactoryimpl$simplefactory
, SunJSSE:TrustManagerFactory.PKIX-Co.ssl.internal.ssl.trustmanagerfactoryimpl$pkixfactory
Aliases: [Sunpkix, X509,]
, SunJSSE:SSLContext.SSL-Co.ssl.internal.ssl.SSLContextImpl
, SunJSSE:SSLContext.SSLv3-Co.ssl.internal.ssl.SSLContextImpl
, SunJSSE:SSLContext.TLS-Co.ssl.internal.ssl.SSLContextImpl
, SunJSSE:SSLContext.TLSv1-Co.ssl.internal.ssl.SSLContextImpl
, SunJSSE:SSLContext.Default-Co.ssl.internal.ssl.DefaultSSLContextImpl
, SunJSSE:KeyStore.PKCS12-Co.ssl.internal.pkcs12.PKCS12KeyStore
]
Java.ext.dirs:c:\java\jre6\lib\ext; C:\Windows\Sun\Java\lib\ext
Com.microsoft.sqlserver.jdbc.SQLServerException: The driver cannot establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "RSA premaster secret Error".
At Com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate (sqlserverconnection.java:1352)
At Com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL (iobuffer.java:1533)
At Com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper (sqlserverconnection.java:1042)
At Com.microsoft.sqlserver.jdbc.SQLServerConnection.login (sqlserverconnection.java:817)
At Com.microsoft.sqlserver.jdbc.SQLServerConnection.connect (sqlserverconnection.java:700)
At Com.microsoft.sqlserver.jdbnnect (sqlserverdriver.java:842)
At Java.sql.DriverManager.getConnection (Unknown Source)
At Java.sql.DriverManager.getConnection (Unknown Source)
At Conndb.main (conndb.java:14)


Online access to information, found that some people say that the problem is the JDBC driver package, but after changing the driver package, the problem remains unresolved.

After I changed my window-〉preference-〉java-〉install jres to Jre6, the problem was solved.

I used the JDK, directory in C:\Program files\java\jdk1.6.0_25, changed to the JRE directory is C:\Program files\java\jre6.



Although I do not know why, but the problem finally solved.

The driver cannot establish a secure connection exception resolution by using Secure Sockets Layer (SSL) encryption with SQL Server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.