配置c3p0连接池出现错误:java.sql.SQLException: An attempt by a client to checkout a Connection has timed

mysql是8版本的,在学习c3p0链接池配置的时候出现了一些问题,记录一下错误..

刚开始出现的是这个错误 :java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector

查了一下是缺少了mchange-commons-java-0.2.19.jar这个jar包

但后边出现了:java.sql.SQLException: An attempt by a client to checkout a Connection has timed

最后改了一下url就好了

 <property name="jdbcUrl">jdbc:mysql://localhost:3306/mydb?useUnicode=true&amp;characterEncoding=utf-8&amp;useSSL=true&amp;serverTimezone=UTC</property>

原因是 &的这个符号要用转义字符 &amp;

mysql8的jdbcurl需要设置时区,url至少后边跟serverTimezone=UTC 设置一下时区

猜你喜欢

转载自www.cnblogs.com/shellxx/p/12909581.html