tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Fountain" <tfount...@benefitconcepts.com>
Subject RE: Suggestions for connection pooling
Date Fri, 26 Oct 2007 13:25:35 GMT
Everyone, thanks for the feedback and additional suggestions on "clean
coding" :).  I think I'm good to go.

Thanks,
Tony

-----Original Message-----
From: Len Popp [mailto:len.popp@gmail.com] 
Sent: Thursday, October 25, 2007 5:25 PM
To: Tomcat Users List
Subject: Re: Suggestions for connection pooling

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


________________________________________________________________________
This Email has been scanned for all viruses by PAETEC Email Scanning
Services, utilizing MessageLabs proprietary SkyScan infrastructure. For
more information on a proactive anti-virus service working around the
clock, around the globe, visit http://www.paetec.com.
________________________________________________________________________

---------------------------------------------------------------------
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