Exception in thread “main” com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: ‘java.lang.NumberFormatException: For input string: “3306:cgb2022”’.
解决方案 :
String url = “jdbc:mysql://localhost:3306:cgb2022”;
改为:
String url = “jdbc:mysql://localhost:3306/cgb2022”;
把冒号改为 / 即可
这是很简单的写错了 …