`

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>  
 
分享到:
评论

相关推荐

    mysql密码过期导致连接不上mysql

    mysql密码过期了,今天遇到了连接mysql,总是连接不上去, 错误现象1: An attempt by a client to checkout a Connection has timed out 第一次出现连接超时错误,第一反应是去修改cpool.checkoutTimeout参数为...

    c3p0数据库连接

    DataSourceUtils.java c3p0数据库连接

    An attempt at a C++ tutorial..zip

    An attempt at a C++ tutorial.

    计算机网络第六版答案

    An ISP earns its money by charging each of the the ISPs that connect to the IXP a relatively small fee, which may depend on the amount of traffic sent to or received from the IXP. 15. Google's ...

    Kerberos Administration Guide

    The Kerberos protocol uses strong cryptography so that a client can prove its identity to a server (and vice versa) across an insecure network connection. After a client and server has used Kerberos ...

    2009 达内Unix学习笔记

    把前一命令的输出作为后一命令的输入,把几个命令连接起来。 |经常跟tee连用,tee 把内容保存到文档并显示出来。 三、通用后接命令符 -a 所有(all)。 -e 所有(every),比a更详细。 -f 取消保护。 -i 添加...

    微软内部资料-SQL性能优化3

    For example, suppose a transaction scanned a page using an S lock and then subsequently decided to perform a row level update. The row would obtain an X lock, but now the page would require an IX ...

    BURNINTEST--硬件检测工具

    - Updated license management, in an attempt to remove a rare crash on startup. Release 5.3 build 1012.0002 WIN32 release 31 October 2007 - New build of Rebooter (64-bit Windows correction). - ...

    Electronics A Systems Approach 6th Edition by Neil Storey- 2017

    This second edition has given an opportunity to update the text and to take account of developments in a very rapidly changing field. It has also permitted several major revisions of the text. The ...

    PyOpenGL-3.1.5-cp37-cp37m-win_amd64.whl

    解决:OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutI 下载后,在该目录打开cmd,安装pip install PyOpenGL-3.1.5-cp37-cp37m-win_amd64.whl

    From Theory to Practice: An overview of MIMO

    This paper presents an overview of recent progress in the area of multiple-input multiple-output (MIMO) space-time coded wireless systems. After some background on the research leading to the ...

    A Practical Guide to Designing with Data.pdf

    new ʻvisualizationsʼ are an attempt to explain the underlying information with a powerful visual impact. They take complex ideas and distil them into beautiful graphics revealing the ...

    VB编程资源大全(英文源码 网络)

    You can send messages with a client/server type setup.&lt;END&gt;&lt;br&gt;57 , al40.zip Apparently, if you use AOL to connect to the Internet and you do not touch it for 45 minutes it will timeout and drop ...

    Kwin Scripts

    * 1.1.1: Bugfixes and an attempt to adjust to new or removed panels * 1.1.2: Enable resize "animations" and bugfixes (again including panel struts) * 1.1.3: Retile on layout switch and keep desktop ...

    Programmable Logic Controllers A Practical Approach TO IEC 61131-3 Using CoDeSys

    This development was the natural result of the attempt by the producers to make themselves stand out among increasing competition by developing the most user friendlylanguages and tools.

    php.ini-development

    data to the client. If your application's output exceeds this setting, PHP ; will send that data in chunks of roughly the size you specify. ; Turning on this setting and managing its maximum buffer ...

    pso.zip_Economic load_lambda iteration_linear system_pso Optimal

    The economic load dispatch plays an important role in the operation of power ... Here, an attempt has been made to find out the minimum cost by using PSO using the data of three and six generating units

    微软内部资料-SQL性能优化2

    If you attempt to access a reserved address that has not yet been committed (backed by memory or disk) you will cause an access violation. Committed Memory Committed pages are those pages that when ...

    折半查找 binarySearch

    It makes progressively better guesses, and closes in on the sought value, by comparing an element halfway with what has been determined to be an element too low in the list and one too high in the ...

Global site tag (gtag.js) - Google Analytics