This is how I create a DataSource with DBCP 1.4 connection factory:
PoolableConnectionFactory factory = new PoolableConnectionFactory(
new DriverManagerConnectionFactory("jdbc:h2:mem:db", "", ""),
new GenericObjectPool(null),
null,
"SELECT 1",
false,
true
);
DataSource src = new PoolingDataSource(factory.getPool());
Works fine, but I don't know how to configure it, with parameters listed here: http://commons.apache.org/dbcp/configuration.html. For example, I need to set testWhileIdle
to true
.