c3p0出现 An attempt by a client to checkout a Connection has timed out
Posted cxchanpin
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c3p0出现 An attempt by a client to checkout a Connection has timed out相关的知识,希望对你有一定的参考价值。
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out. at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:527) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from [email protected] -- timeout at awaitAvailable() at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1317) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:590) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:590) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:590) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:590) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:590) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:590) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:590) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525) ... 7 more
解决方法:缓存关闭也就是把c3p0.max_statements 设置成0(假设不设置为0,可能造成connection不能真正被关闭),这样就不会有缓存的preparedstatement。而设置的c3p0.idle_test_period又小于c3p0.timeout,这种设置应该解决这个问题了。
以上是关于c3p0出现 An attempt by a client to checkout a Connection has timed out的主要内容,如果未能解决你的问题,请参考以下文章
c3p0连接错误 An attempt by a client to checkout a Connection has timed out.
关于c3p0连接mysql8.0.11 配置文件 url 错误问题;An attempt by a client to checkout a Connection has timed out 问题解决
JDBC以及连接池连接MySQL出现时区错误问题--An attempt by a client to checkout a Connection has timed out
An error can be caused by attempting to divide by 0的解释
Nginx 提示10013: An attempt was made to access a socket in a way forbidden by its access permissions
10013: An attempt was made to access a socket in a way forbidden by its access permissions