commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Field-Elliot <>
Subject DBCP validation query: how to use?
Date Sun, 09 Jun 2002 04:39:06 GMT
I'm using the latest DBCP release to create a Datasource as follows,
against a PostgreSQL database:

			ObjectPool connectionPool = new GenericObjectPool(null);
			ConnectionFactory connectionFactory = new
"bryan", "nopw");
			String validationQuery = "select 1 as test";
			PoolableConnectionFactory poolableConnectionFactory = new
PoolableConnectionFactory(connectionFactory, connectionPool, null,
validationQuery, false, true);
			dataSource = new PoolingDataSource(connectionPool);

I'm chasing down a different bug which is hosing my postgres connections
- trying to insert strings into TEXT fields, which contain nulls.
Evidently Postgres doesn't like that, and hoses the connection.

But, according to how I've initialized the pool (above), should DBCP be
testing my connections with my validation query, noticing my hosed
connections, and creating new ones for me? Observed behavior indicates
otherwise... It keeps resuing the hosed connection to future calls of
dataSource.getConnection(), throwing off future executing code.

Am I doing something wrong?

Thank you,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message