Well, I guess the subject line says it all. I'm having memory issues, and having read
the OOM error messages on the list, I've checked and found some open and not being
closed connections, so I'm going back and closing them all. The question is do I need
to explicitly close/dereference (set
Closing the resultsets, statements and connections frees up database resources. In
the case of connection pooling, a call to the close() method may actually be releasing
the connection back into the pool.
-Original Message-
From: Michael Nicholson [mailto:[EMAIL PROTECTED]]
Sent:
By closing you mean set the ResultSet and Statement objects to null -
correct?
-Original Message-
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: August 27, 2002 9:06 AM
To: Tomcat Users List
Subject: Re: Does closing a Connection variable and setting it to null
close all of
Michael,
As per the Java documentation, resultsets are closed when the statement
is closed, and Statement's are closed during garbage collection. But in
my own opinion, it's better to close them individually and explicitly,
so you the programmer know it is done, and someone reading your code
No, you should invoke .close() on your resultset and statement object.
Setting to null is also a good idea, but not as important as closing the
objects.
- Andrew
-Original Message-
From: Short, Dave [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 27, 2002 12:09 PM
To: 'Tomcat
On Tue, 27 Aug 2002, Short, Dave wrote:
Date: Tue, 27 Aug 2002 09:08:58 -0700
From: Short, Dave [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Subject: RE: Does closing a Connection variable and setting it to null
clo se all
Hmm, this example code should get added to the Tomcat JNDI-DataSource-HOWTO. :-)
Craig R. McClanahan wrote:
On Tue, 27 Aug 2002, Short, Dave wrote:
Date: Tue, 27 Aug 2002 09:08:58 -0700
From: Short, Dave [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: 'Tomcat Users
I wrote a booch utility class (fancy name for static methods...)
It has a whole lot of overloaded (Connection, PreparedStatement,
Statement, ResultSet etc) methods like this... (LOGGER is a JDK1.4 logger)
public static void closeJDBCResource(ResultSet rs) {
try {
if (rs !=