Hello:
I have the following code in my app to get a connection
pool to a MySQL database:
String dbUri = "jdbc:mysql://localhost:3306/mydb";
ConnectionFactory connectionFactory = new
DriverManagerConnectionFactory(dbUri,user,password);
GenericObjectPool connectionPool = new GenericObjectPool(null);
connectionPool.setMinEvictableIdleTimeMillis(5*60*1000);
connectionPool.setTimeBetweenEvictionRunsMillis(15*60*1000);
new
PoolableConnectionFactory(connectionFactory,connectionPool,null,"select
1",false,true);
((org.apache.commons.pool.impl.GenericObjectPool)connectionPool).setTestOnBo
rrow(true);
return new PoolingDataSource(connectionPool);
I have a long running cron job that is giving me this error:
The last packet sent successfully to the server was 41,120,156 milliseconds
ago.
is longer than the server configured value of 'wait_timeout'. You should
consider
either expiring and/or testing connection validity before use in your
application,
increasing the server configured values for client timeouts, or using the C
onnector/J connection property 'autoReconnect=true' to avoid this problem.
So, it looks like the connection validation is not happening.
Did I do something wrong in my code?
Thanks,
Neil
--
Neil Aggarwal, (972)834-1565, http://UnmeteredVPS.net/centos
Virtual private server with CentOS 6 preinstalled
Unmetered bandwidth = no overage charges
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]