Eclipse建立数据库连接失败

mysql驱动包为:mysql-connector-java-8.xxx.jar版的,需要将代码中加载类改为:

Class.forName("com.mysql.cj.jdbc.Driver");

代码中的url改为:

Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/testjdbc?&useSSL=false&serverTimezone=UTC","root","password");

你可能感兴趣的:(数据库,mysql)