commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andres Galeano <agale...@perfectorder.com>
Subject [dbcp] Stmt Pooling FAQ Update and Example
Date Tue, 24 May 2005 14:32:39 GMT
Hi all,

I'd like to offer an answer to one of your unanswered FAQs:

On: http://wiki.apache.org/jakarta-commons/DBCP
Under: FAQ
There is the following question:

************************************************************
Q: <nowiki>Does the current 1.1 release support the poolable/caching of
PreparedStatements. (etc...)

A: ??
************************************************************

Currently this question is unanswered.  I had the same issue, and
through reading the API of commons-DBCP and commons-POOL I was able to
figure out how to use your Prepared Statement pooling.

In face I created JUnit test case(attached) that shows exactly how to do
this.

I think it would be great if you could answer this questions with
something like:

************************************************************
A: The implementation of
org.apache.commons.pool.KeyedPoolableObjectFactory we provide is
org.apache.commons.dbcp.PoolingConnection.   You don't see it in the
commons-pool api because it's exists in the commons-dbcp api.

You can created one with code like this:
------------
ConnectionFactory connectionFactory = new
DriverManagerConnectionFactory(url, user, password);
new PoolingConnection(connectionFactory.createConnection());
------------

Remember to close your PoolingConnection when your done, so that the
underlying java.sql.Connection also get's closed.

Also see this example that Andres Galeano
<andres.galeano@perfectorder.com> from Perfect Order has provided...
************************************************************

Any way, Thanks for reading this,
Andy G.
-- 
Andres Galeano <andres.galeano@perfectorder.com>
Perfect Order Software Solutions
Work: 717-506-1112 x350
Cell: 717-919-5524
AIM/ICQ id: andygaleano

Mime
View raw message