SQLException: An attempt by a client to checkout a Connection has timed out

在测试黑马JavaWeb连接池成C3P0时报错:
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
如图:

QQ拼音截图20191212131149.png

原因分析:视频教程中用的mysql驱动是:mysql-connector-java-5.1.37-bin.jar
我的测试环境mysql8.0,用的驱动是:mysql-connector-java-8.0.17.jar。
所以配置文件c3p0-config.xml中修改成mysql8.0的配置,修改后的配置如下:
com.mysql.cj.jdbc.Driver
jdbc:mysql://localhost:3306/db4?useSSL=false&serverTimezone=UTC
QQ拼音截图20191212131952.png

测试运行,终于是我想要的结果了
QQ拼音截图20191212132212.jpg

你可能感兴趣的:(SQLException: An attempt by a client to checkout a Connection has timed out)