Solve the problem that the java driver for connecting to the SQLSERVER database cannot establish a secure connection with SQL Server by using Secure Sockets Layer (SSL) encryption. Error: Could not gen

The operating system win10 x64, sql2016

This problem is the problem of the security key between the JDK and the database:
my system is 64-bit, this problem did not occur on 32-bit machines before: the
program will report com.microsoft as soon as the program connects to the database .sqlserver.jdbc.SQLServerException: The driver was unable to establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "Java.lang.RuntimeException: Could not generate DH keypair". such a mistake.
JDK 1.6 will report this error, and 1.7 will not report this error.
Finally, using 1.6 finally solved it: the
solution is:
1. Download two jar packages (attachments)
1. bcprov-ext-jdk15on -1.54.jar 2.
bcprov-jdk15on-1.54.jar
2. Copy the two downloaded JAR files Go to: JDK installation directory\jre\lib\ext, for example, mine is D:\Program Files (x86)\java\JDK1.6\jre\lib\ext
3. Open the java.security file: in the JDK installation directory\ The java.security file under jre\lib\security.
Find security.provider.1=sun.security.provider.Sun and replace
it with security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider
You can re-execute the program to connect to the database.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326305483&siteId=291194637
Recommended