I've looked at the CVS HEAD for PoolingConnection...
http://cvs.apache.org/viewcvs.cgi/jakarta-commons/dbcp/src/java/org/apache/c
ommons/dbcp/PoolingConnection.java?view=markup

public synchronized PreparedStatement prepareStatement(String sql) throws
SQLException {
        try {
 
return(PreparedStatement)(_pstmtPool.borrowObject(createKey(sql)));


>From this code, I surmise the following: 

When you do multiple calls to prepareStatement(foo), where 'foo' contains
the same SQL string, then the "PoolingConnection" object will automatically
give you back a previously pooled preparedstatement.  So the answer to you
question: "how do I access these pooled statement?" might be as simple as
"don't worry about it, just use the prepareStatement() API and DBCP handles
it for you". 

I don't know for sure and you'll probably get more traction asking this
specific question on the commons-user email list. And uh.. I probably coulda
just started there...

http://marc.theaimsgroup.com/?l=jakarta-commons-user&m=112975440702682&w=2

> >
> >
> > > -----Original Message-----
> > > From: Khawaja Shams [mailto:[EMAIL PROTECTED]
> > > Sent: Thursday, January 12, 2006 11:12 PM
> > > To: Tomcat Users List
> > > Subject: Re: PreparedStatement w/ Connection Pooling
> > >
> > > I am guessing the main attribute to change is the following:
> > >   poolPreparedStatements="true"
> > >
> > > Suppose that this is set to true, how do I access these pooled 
> > > statement? My setup is exactly as you described, so this 
> > > modification seems minor, but I
> > > would appreciate guidance on how to get a hold of these
> > > pooled prepared
> > > statement.  Thanks for your help.
> > >
> > > Sincerely,
> > > Khawaja Shams
> > >


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to