SQL Server database connection problem solving record in MyEclipse

December 12, 2016 953 point heat 1 liked it 0 comments

Com.microsoft.sqlserver.jdbc.sqlserverexception: the driver was unable to establish a secure connection with SQL server by using secure socket layer (SSL) encryption. Error: "java.lang.runtimeexception: could not generate DH keypair".

This historical legacy problem has a long history, and the content on the Internet is similar. The solutions to the problem are also various, but they all end up with unclear answers. The audience is also confused. The bloggers also encounter this problem, and they haven't solved it for a long time. This article only makes a record to prepare for the unexpected need.

1. According to what is said on the Internet, the document has been replaced, but it still can't be solved


This big brother said very clearly, once tried this, but still can't, finally understood the problem.

Fang's case:

Download two jar packages: bcprov-ext-jdk15on-1.54.jar and bcprov-jdk15on-1.54.jar

Download address: http://download.csdn.net/detail/cw_ hello1/9557049

Step 2: copy the two downloaded jar files to the JDK installation directory: JRE / lib / ext, for example, my one is f: JDK / JDK6 / JRE / lib / ext

Open the Java. Security file: the Java. Security file in the JDK installation directory, which is located under the JDK installation directory.

Find security. Provider. 1 = sun. Security. Provider. Sun and replace it with


Let's talk about my test environment: Windows 10 + MyEclipse 8.6 + SQL Server 2012,

The first time I encountered this problem, I suddenly couldn't connect to the database. I immediately searched the Internet and saw the article mentioned at the beginning of CSDN. I thought it was so simple. According to the author's idea, I found the shortcut to the software in the menu, opened the installation directory of MyEclipse 8.6, and then finished the operation step by step, But the result is: the problem still exists, which makes me puzzled~

At last, I realized that I was wrong from the beginning

The correct way is to open MyEclipse 8.6, open windows, preference, Java, installed JRE, select JDK, and click Edit

Get the path   C: The user name is appdata, local, genuitec, common, binary, com.sun.java.jdk.win32.x86_

And then, in this folder, do the above operations

Last but not least, restart the computer! Restart the computer! Restart the computer( Say important things three times)

Refer to the following figure:

Figure 1

Figure 2

Figure 3

Extraction password: gcod

Two jar packages are used in this paper Size: | source: enterprise cloud disk
Security software has been tested non-toxic, please feel free to download.


If life is just like the first sight, what is the sad autumn wind painting fan

Article review