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:[EMAIL PROTECTED] 
Sent: Thursday, October 25, 2007 5:25 PM
To: Tomcat Users List
Subject: Re: Suggestions for connection pooling

On 10/25/07, Tony Fountain <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


________________________________________________________________________
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to