看看你的驱动用的是:com.mysql.cj.jdbc.Driver还是com.mysql.jdbc.Driver
看看你的getConnection方法喃,下面这个写法是能用的
Connection conn = null;
Statement statement = null;
ResultSet rs;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(jdbcUrl, userName, password);
statement = conn.createStatement();
rs = statement.executeQuery(sql);
} catch (Exception e) {
}