commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Hixson <hix...@poindextrose.org>
Subject Re: [dbcp] java.io.EOFException, underlying cause: null
Date Mon, 20 Apr 2009 15:54:11 GMT
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: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message