zoukankan      html  css  js  c++  java
  • 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 com.mchange.v2.resourcepool.BasicResourcePool@a0e5175 -- 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,这种设置应该解决这个问题了。
  • 相关阅读:
    寒假Day31:CSU1508地图的四着色bfs+dfs
    寒假Day32:链式前向星
    寒假Day30:HDU4507吉哥系列故事恨7不成妻数位dp
    寒假Day35:HTML表格+图像+超链接
    寒假Day35:2018蓝桥杯 B组
    寒假Day33:HTML入门
    寒假Day30:二叉树的遍历相关题型(求先序或后序、搜索树的判断)
    POJ 1177 Picture (线段树+离散化+扫描线) 详解
    MFC对话框中文出现乱码的解决方法
    如何枚举系统COM串口
  • 原文地址:https://www.cnblogs.com/cxchanpin/p/7040546.html
Copyright © 2011-2022 走看看