`package sqltest;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class testuser {
private static String url = "jdbc:mysql://localhost:3306/terminaldb?useSSL=false";
private static String user = "testuser";
private static String password = "testpassword";
private static String driver = "com.mysql.jdbc.Driver";
private static int id = 0;
private static String hostname = "HP";
public static void main(String[] args){
Getconn get = new Getconn();
Connection conn = get.getconn();
PreparedStatement ps = null;
id++;
String insertSql = "insert into filesyslog (id,hostname,operation,date) values(?,?,?,?)";
try{
ps = conn.prepareStatement(insertSql);
ps.setInt(1, 12345);
ps.setString(2, hostname);
ps.setString(3, "abcd");
ps.setString(4, "date now date");
ps.executeQuery();
}
catch(Exception e){
}
}
}
`
我已经添加了?useSSL=false,并且已经检查MySQL中ssl为disabled
但是仍然有如下提示
Sun Dec 01 10:59:03 GMT+08:00 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
java.beans.Statement ps = null;