commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Dudley <sc...@telesoft.com>
Subject DBCP 1.2.2: Test on Borrow not Working
Date Wed, 21 Nov 2007 16:32:34 GMT

I've implemented a pool using the BasicDataSource and just discovered 
that the test on borrow validation SQL isn't working.  I'm not at all 
familiar with either commons logging or log4j and can't for the life of 
me figure out how to turn on debugging for this jar.

Code snippet as follows:

    BasicDataSource dataSource = new BasicDataSource();

    dataSource.setUsername(username);
    dataSource.setPassword(password);
    dataSource.setUrl(url);
    dataSource.setInitialSize(initialSize);
    dataSource.setMinIdle(initialSize);
    dataSource.setMaxActive(maxSize);
    dataSource.setValidationQuery("select 1 from dual");
    dataSource.setTestOnBorrow(true);

    ...

    Connection con = dataSource.getConnection();

If I first initialize the pool, get a connection, and then restart my 
database - a subsequent call to dataSource.getConnection() returns a bad 
connection that has not passed the validation query.  I verified this by 
manually executing the same statement on the connection and it throws a 
SQLException with "broken pipe" or "cannot read from socket" error 
depending on Oracle version.

Please help.  Additionally, if someone can enlighten me on how to turn 
on debugging I'd be forever grateful.

Thanks.

-- 

Regards,

Scott Dudley


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


Mime
View raw message