import java.sql.Connection; 导入java.sql.DriverManager;
类JDBCTest {
private static final String url = "jdbc:mysql://localhost:mysql/employees";
private static final String user = "shashank";
private static final String password = "shashank14581";
public static void main(String args[]) {
try {
Connection con = DriverManager.getConnection(url, user, password);
System.out.println("Success");
} catch (Exception e) {
e.printStackTrace();
}
}
}
答案 0 :(得分:0)
尝试在连接之前添加
Class.forName(com.mysql.jdbc.Driver);
此外,在此处放置例外
大卫