tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian" <bbprefix-m...@yahoo.com>
Subject RE: Tomcat 6.0.29 using more and more RAM until it collapses?
Date Thu, 11 Nov 2010 19:44:05 GMT
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.Caldarale@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-mail@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-unsubscribe@tomcat.apache.org>
users-unsubscribe@tomcat.apache.org

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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message