SQL Server database connection problem solving record in MyEclipse

December 12, 2016 608 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

http://blog.csdn.net/u012557538/article/details/52010359

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

security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider

My test in eclipse + windows 18.0,

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 completed the operation step by step, but the result was: the problem is that It 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: users \ \ user name / appdata / local / genuitec / common / binary / com.sun.java.jdk.win32.x86_ 1.6.0.013

In this folder, you can do the operation mentioned above

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.

Gcod

Talking about the trivial matters of life and talking about the whole world, that's all

Article review