Hi Mark, I'm just using GenericObjectPool and it does not have a
setValidationQuery() method. Do I need to use a more specific object
pool class or did you mean that setValidationQuery needs to be called
on something else? My method now looks like:
GenericObjectPool pool = new GenericObjectPool(null);
pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
pool.setTestOnBorrow(true);
pool.setTestOnReturn(true);
pool.setTimeBetweenEvictionRunsMillis(10000);
pool.setTestWhileIdle(true);
ConnectionFactory connectionFactory = new
DriverManagerConnectionFactory(jdbcUrl),null);
new
PoolableConnectionFactory(connectionFactory,pool,null,null,false,true);
return(new PoolingDataSource(pool));
Thanks,
-M@
On Apr 20, 2009, at 1:28 AM, Mark Thomas wrote:
Matthew Hixson wrote:
Occasionally I'll see this exception in our logs. I have setup the
pool
like so:
GenericObjectPool pool = new GenericObjectPool(null);
pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_GROW);
pool.setTestOnBorrow(true);
pool.setTestOnReturn(true);
pool.setTestWhileIdle(true);
Is that not sufficient to have DBCP test a connection before
releasing
it from the pool for use?
No. You need to call set the validation query too. E.g.:
pool.setValidationQuery("SELECT 1");
HTH,
Mark
Thanks,
-M@
-------------------------------------------
java.sql.SQLException: Communication link failure:
java.io.EOFException,
underlying cause: null
** BEGIN NESTED EXCEPTION **
java.io.EOFException
STACKTRACE:
java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1395)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:1539)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1930)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2281)
at
com
.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:
1634)
at
org
.apache
.commons
.dbcp
.DelegatingPreparedStatement
.executeQuery(DelegatingPreparedStatement.java:93)
...
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]