银行管理系统,可以出GUI界面,但是写不进数据
//1.注册驱动
String driverClassName = "com.mysql.jdbc.Driver";
Class.forName("com.mysql.jdbc.Driver");
//2.连接数据库
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3308/ren?useUnicode=true&characterEncoding=UTF-8","root","1234");
Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class is
com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
你的MySQL是8.+版本的,需要用com.mysql.cj.jdbc.Driver这个驱动,但是用5.+版本的驱动也没问题,不算错误,一个告警信息吧
提示你驱动类过时了,用com.mysql.cj.jdbc.Driver代替com.mysql.jdbc.Driver。