为什么我有这个问题?
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/esame/useJDBCCompliantTimezoneShift=true;useLegacyDatetimeCode=false;serverTimezone=UTC;
这是我的代码: 导入java.sql。*; 公共类DBConnector {
private final String NOME_DRIVER = "com.mysql.cj.jdbc.Driver";
private String url;
private String user;
private String password;
private Connection conn;
private Query qr;
public DBConnector(String url, String user, String password) throws ClassNotFoundException, SQLException {
setUrl(url); setUser(user); setPassword(password);
Class.forName(getNomeDriver());
setConn(DriverManager.getConnection(getUrl(), getUser(), getPassword()));
}
public String getNomeDriver() {
return this.NOME_DRIVER;
}
}
我添加了外部jar以在Eclipse中构建路径。