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]