Hi Chuck,

 

Yes, in a Finally block. This is what I do:

 

      void closeRsStmt(ResultSet resultSet)

      {

                  //"Close" the connection, so it goes back to the pool

                  Statement stmt=null;

                  Connection conn=null;

                  try

                  {

                        if (resultSet!=null )

                        {

                              stmt = resultSet.getStatement();

                              resultSet.close();

                        }   

                  }

                  catch (SQLException ex)

                  {

                  }

                  try

                  {

                        if (stmt!=null )

                        {

                              conn=stmt.getConnection();

                              stmt.close();

                        }   

                  }

                  catch (SQLException ex)

                  {

                  }

                  try

                  {

                        if (conn!=null)

                        {

                              conn.close();

                        }

                  }

                  catch (SQLException ex)

                  {

                  }

                  resultSet = null;

                  stmt = null;

                  conn = null;

      }

 

 

> -----Original Message-----

> From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]

> Sent: Thursday, November 11, 2010 02:32 PM

> To: Tomcat Users List

> Subject: RE: Tomcat 6.0.29 using more and more RAM until it collapses?

> 

> > From: Brian [mailto:bbprefix-m...@yahoo.com]

> > Subject: RE: Tomcat 6.0.29 using more and more RAM until it collapses?

> 

> > After I perform a SQL sentence, I close the objects (result set, then

> > its statement).

> 

> In a finally block?  If not, you'll leave them open when an exception
occurs.

> 

>  - Chuck

> 

> 

> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE

> PROPRIETARY MATERIAL and is thus for use only by the intended recipient.
If

> you received this in error, please contact the sender and delete the
e-mail and its

> attachments from all computers.

> 

> 

> ---------------------------------------------------------------------

> To unsubscribe, e-mail:  <mailto:users-unsubscr...@tomcat.apache.org>
users-unsubscr...@tomcat.apache.org

> For additional commands, e-mail:  <mailto:users-h...@tomcat.apache.org>
users-h...@tomcat.apache.org

Reply via email to