配置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 设置一下时区

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

上一篇:mysql数据库中吧时分秒换算成秒的函数TIME_TO_SEC()


下一篇:golang sql 包连接池分析