mysql连接池断掉的解决方法:
1.修改c3p0的配置文件。
# Prevent MySQL raise exception after a long idle timecpool.preferredTestQuery='SELECT 1'cpool.idleConnectionTestPeriod=18000cpool.testConnectionOnCheckout=true
2.再修改Spring的配置文件。
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="preferredTestQuery" value="${cpool.preferredTestQuery}"/>
<property name="idleConnectionTestPeriod" value="${cpool.idleConnectionTestPeriod}"/>
<property name="testConnectionOnCheckout" value="${cpool.testConnectionOnCheckout}"/>
<!--other properties --></bean>