问题遇到的现象和发生背景
银行管理系统,可以出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.