org.hibernate.exception.GenericJDBCException:无法获取JDBC连接

时间:2016-06-02 06:28:28

标签: spring hibernate connection-pooling c3p0

我们正在使用c3p0连接池,以下是设置

<bean id="dataSource"  
  class="com.mchange.v2.c3p0.ComboPooledDataSource">  
    <property name="driverClass" value="${jdbc.driver}" />  
    <property name="jdbcUrl" value="${jdbc.url}" />
    <property name="user" value="${jdbc.username}" />  
    <property name="password" value="${jdbc.password}" />  
    <property name="initialPoolSize"><value>3</value></property>
    <property name="minPoolSize"><value>25</value></property>
    <property name="maxPoolSize"><value>200</value></property>
    <property name="idleConnectionTestPeriod"><value>200</value></property>
    <property name="acquireIncrement"><value>25</value></property> <!--  -->
    <property name="maxStatements"><value>0</value></property>  <!-- 0 means: statement caching is turned off.  -->
    <property name="numHelperThreads"><value>3</value></property>  <!-- 3 is default --> 
    <property name="acquireRetryAttempts"><value>3</value></property>  
    <property name="maxIdleTime"><value>3600</value></property>    
    <property name="maxConnectionAge"><value>7200</value></property>    
    <property name="maxIdleTimeExcessConnections"><value>600</value></property>    
    <property name="preferredTestQuery"><value>select 1 from DUAL</value></property> 
    <property name="testConnectionOnCheckin"><value>true</value></property>    
    <property name="testConnectionOnCheckout"><value>false</value></property>    
    <property name="connectionCustomizerClassName"><value>com.common.ConnectionPoolLogger</value></property>    

 </bean>

我们正在追踪异常

org.hibernate.exception.JDBCConnectionException: could not extract 
ResultSet at org.hibernate.exception.internal.SQLStateConversionDelegate

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 
Communications link failure The last packet successfully 
received from the server was 4,314 milliseconds ago. The last packet sent successfully to the server was 168 milliseconds ago

0 个答案:

没有答案