mysql 8小时解决

以前解决8小时问题通过设置不起作用,后来使用poxool池就可以

 

这次发现dbcp还是好些,可能还是配置问题:
http://stackoverflow.com/questions/8535433/spring-app-losing-connection-to-mysql-after-8-hours-how-to-properly-configure
从其答案中说是需要配置:
testWhileIdle, validationQuery and timeBetweenEvictionRunsMillis
这里有个例子
validationQuery = "SELECT 1" 
testWhileIdle = "true"   
timeBetweenEvictionRunsMillis = "3600000" 
minEvictableIdleTimeMillis = "18000000"
testOnBorrow = "true"
有人说
timeBetweenEvictionRunsMillis
这个值不能设置>time_out
但http://stackoverflow.com/questions/15949/javatomcat-dying-database-connection
几个例子都比它大,所以应该是要设置testWhileIdle=true
dbcp文档:
http://commons.apache.org/dbcp/configuration.html


Total views.

© 2013 - 2018. All rights reserved.

Powered by Hydejack v6.6.1