Hello,
I've browsed that archives for info about DBCP connection pools, but I still can't figure out where I've gone astray. I'm using Java DB in a desktop application and want to create a Connection Pool because I'm accessing the database with multiple threads (I started bumping into ResultSet exceptions due to concurrency issues). I've basically been following the suggested implementations of the apache commons dbcp package. A summary for usage can be found here:
http://commons.apache.org/dbcp/apidocs/org/apache/commons/dbcp/package-summary.html
The relevant code that I grabbed from their summary is:
GenericObjectPool connectionPool = new GenericObjectPool(null);
ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string", "username", "password");
PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(connectionFactory,connectionPool,null,null,false,true);
PoolingDriver driver = new PoolingDriver();
driver.registerPool("example",connectionPool);
When I grab a few connections from the database using the DriverManager.getConnection() method everything seems to work fine, but when I ran a test where I tried to grab 8 connections (without closing them), the application stalled. I'll be happy to provide full runnable code if this helps, but I thought I'd just ask with this preliminary info in case I'm simply suffering from a fundamental misunderstanding of how this works.
Thanks!