Article directory
1. Problem Analysis
The SSL protocol provides services mainly:
- Authenticating user servers to ensure data is sent to the correct server.
- Encrypt data to prevent data from being stolen during transmission
- Maintain data integrity and verify that data is not lost in transit
It is not recommended to establish an SSL connection without server authentication. As required by MySQL 5.5.45+, 5.6.26+, and 5.7.6+, a default SSL connection must be established if no explicit option is set. SSL needs to be explicitly disabled by setting useSSL=false , or set useSSL=true and provide a trust store for server certificate verification.
2. java to connect to the MySQL database
Modify the url, adduseSSL=false
jdbc:mysql://localhost:3306/数据库名?useSSL=false
3.java connects to the SQL Server database
3.1 Create a security file
The file name can be customized, here I will name it security
It is recommended that the file does not have a suffix, and a txt text file can be created first. Paste the following into the file:
jdk.tls.disabledAlgorithms=SSLv3, 3DES_EDE_CBC, DES, MD5withRSA, \
DH keySize < 1024, EC keySize < 224, anon, NULL, \
include jdk.disabled.namedCurves
After saving the file, rename the file to remove .txt
the suffix.
The path of this security file needs to be known, my path isD:\security
3.2 Add parameters to the project that needs to be run
Parameter format added to VM:"-Djava.security.properties=The security file path just created"
Here I am: "-Djava.security.properties=D:\security"
( Note to write double quotes )
At this time, it will be no problem to run the project again.