tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Len Popp" <len.p...@gmail.com>
Subject Re: Suggestions for connection pooling
Date Thu, 25 Oct 2007 21:24:34 GMT
On 10/25/07, Tony Fountain <tfountain@benefitconcepts.com> wrote:
> Now, my goal is to utilize connection pooling.  Does (a) this
> implementation achieve that and (b) the close statement suffice to
> return the object to the pool and not actually close the connection?  Or
> do I also need to set "conn = null;"?

You don't need to set conn = null, but you *do* need to make sure that
the connection is closed in all cases, even when an exception is
thrown. So:

       Connection conn = ds.getConnection();
       try {
           ...do something...
       } finally {
           conn.close();
       }

-- 
Len

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message