c3p0作为连接池,报:An attempt by a client to checkout a Connection has timed out

3p0作为连接池,报:java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
网上查了很久,有人说是checkoutTimeout太短的原因,(Default: 0)于是由原来的1000改为2000,问题还是未解决。
然后找了份没有问题的配置作了些对比,发现我的maxPoolSize=100显得有些大,于是改为默认的15.再测试,居然没有问题了。后来再试了大一点的60,也没有问题。
下面是我的配置:

<bean id="dataSource"  
        class="com.mchange.v2.c3p0.ComboPooledDataSource"  
        destroy-method="close">  
        <property name="driverClass" value="com.mysql.jdbc.Driver" />  
        <property name="jdbcUrl"  
            value="jdbc:mysql://localhost:3306/gjp" />  
        <property name="user" value="root" />  
        <property name="password" value="gjpgjp" />  
        <property name="initialPoolSize" value="20" />  
        <property name="minPoolSize" value="10" />  
        <property name="maxPoolSize" value="60" />  
        <property name="maxIdleTime" value="7200" />  
        <property name="idleConnectionTestPeriod" value="360" />  
        <property name="preferredTestQuery" value="select 1" />  
        <property name="acquireIncrement" value="5" />  
        <property name="acquireRetryAttempts" value="50" />  
        <property name="acquireRetryDelay" value="1000" />  
        <property name="breakAfterAcquireFailure" value="true" />  
        <property name="checkoutTimeout" value="20000" />  
        <property name="autoCommitOnClose" value="false" />  
        <property name="forceIgnoreUnresolvedTransactions" value="false" />  
        <property name="unreturnedConnectionTimeout" value="1000" />  
        <property name="maxStatements" value="0" />  
        <property name="maxStatementsPerConnection" value="0" />  
        <property name="testConnectionOnCheckin" value="true" />  
        <property name="testConnectionOnCheckout" value="false" />  
        <property name="usesTraditionalReflectiveProxies" value="false" />  
        <property name="numHelperThreads" value="5" />  
    </bean>  
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值