c3p0连接池报错 A client timed out while waiting

今天在看c3p0连接池的时候,因为连接数据库疯狂报错

com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@1c83354 -- timeout at awaitAvailable()

最后查了百度谷歌等,发现谷歌是真的好用啊!!!

在这里插入图片描述
最后找到了解决办法如下:

在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<c3p0-config>
<default-config>
    <property name="driverClass">com.mysql.cj.jdbc.Driver</property>
    <property name="jdbcUrl">jdbc:mysql://localhost:3306/shopping?useUnicode=true&amp;characterEncoding=utf8&amp;serverTimezone=UTC</property>
    <property name="user">root</property>
    <property name="password">123456</property>

    <property name="initialPoolSize">5</property>
    <property name="maxPoolSize">240</property>
    <property name="checkoutTimeout">60000</property>
    <property name="acquireIncrement">1</property>
</default-config>
</c3p0-config>

配置的时候checkoutTimeout这个属性还是不够大,导致连接池还没获取到连接就自动暂停了。

把这个属性的值从3000改成60000就可以了。

猜你喜欢

转载自blog.csdn.net/qq_43458555/article/details/107979797