property preferredTestQuery will be ignored. In this Test you can not do everything on the chart, it will merely test
use c3p0. Default: null ->
retained and the next cry to getConnection (), to continue to try to get joined. If true, then the connection attempt failed
obtain the file source will be permanently closed and loosened state. Default: false ->
SQLException, whether set to 0 to wait indefinitely. Milliseconds. Default: 0 ->
Default: com.mchange.v2.c3p0.impl.DefaultConnectionTester-->
Default: null ->
test tables must be in the initial data source when there is. Default: null ->
time retard its effectiveness. Recommended idleConnectionTestPeriod or automaticTestTable
connection test and additional methods apt enhance representation. Default: disloyal ->
reflective agent to address the dynamic instability problems. The latest non-reflective agent is faster and has begun
warmhearted accustom, so this parameter may not be serviceable. Now the original dynamic reflections and current non-reflective deputies in the meantime be
advocate,
Women's Supra Skytop II, but feasible hereafter editions may not assist dynamic reflection agent. Default: false ->
turn: http://www.wujianrong.com/archives/2007/08/c3p0.html
solve the problem
MYSQL 8 小时 recent project using C3P0 in Hibernate connection pool,
Supra Skytop II Shoes, database Mysql. Development and testing is not problem in running a long period of idle period every arose abnormal:
java code
org.hibernate.exception.JDBCConnectionException: could not execute query at org.hibernate.exception.SQLStateConverter.become ( SQLStateConverter.java: 74) at org.hibernate.exception.JDBCExceptionHelper.conver t (JDBCExceptionHelper.java: 43) ....... Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnect ionException: No operations allowed later connection closed. Connection was implicitly closed due to underlying exception / error: ** BEGIN NESTED EXCEPTION ** com.mysql.jdbc.Communication######ception MESSAGE: Communications interlock failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Broken pipe STACKTRACE: java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0 (Native Method) ...... ** END NESTED EXCEPTION **
view the Mysql documentation,
Women's Supra Vaider Shoes, and Connector / J to Documentation and online help that, for there is this anomaly:
Mysql waiter default This is the problem,
Supra TK Society Shoes, the connections in the C3P0 pools if idle extra than 8 hours, Mysql to disconnect,
Supras, and C3P0 does not understand the connection has failed, if the Client requests when there is connection, C3P0 Connection offers the failure to Client, will reason the on exception.
solution there are three kinds:
increase wait_timeout time. Connection pools in connection to dilute the lifetime. Test Connection pools in connection validity. Of course the best approach is also integrated with the above three methods, respectively,
Supra Trinity NS Shoes, below the DBCP and C3P0 make a note, the default assumption wait_timeout 8 hours
DBCP to add the following configuration information:
/ / set to 'SELECT 1 'validationQuery = a hit for each getConnection (), set to
automaticTestTable = C3P0TestTable
/ / set to something defect in ... than wait_timeout, prevents connections from working stale idleConnectionTestPeriod = 18000 / / set to someone slightly fewer than wait_timeout, preventing 'stale' connections from being handed out maxIdleTime = 25000 / / if you can take the performance 'hit', set to
turn: http://www.javaeye.com/article/38506
my own configuration:
jdbc.driverClass = com.mysql.jdbc.Driver
jdbc.jdbcUrl = jdbc: mysql : / / localhost: 3306/test
jdbc.user = root
jdbc.password = 12345
jdbc.miniPoolSize = 1
jdbc.maxPoolSize = 20
jdbc.initialPoolSize = 1
jdbc.maxIdleTime = 25000
jdbc.acquireIncrement = 1
jdbc.acquireRetryAttempts = 30
jdbc.acquireRetryDelay = 1000
jdbc.testConnectionOnCheckin = true
jdbc.automaticTestTable = c3p0TestTable
jdbc . idleConnectionTestPeriod = 18000
jdbc.checkoutTimeout = 3000
<property name=; $ jdbc.automaticTestTable<property name=