c3p0 connection pool error A client timed out while waiting

Today, when looking at the c3p0 connection pool, a crazy error was reported because of the connection to the database

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()

Finally, I checked Baidu, Google, etc., and found that Google is really easy to use! ! !

Insert picture description here
Finally found the solution as follows:

Insert picture description here

<?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>

The checkoutTimeout property is still not big enough when configuring, causing the connection pool to automatically pause before it gets the connection.

Change the value of this attribute from 3000 to 60000.

Guess you like

Origin blog.csdn.net/qq_43458555/article/details/107979797