tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JensStu...@quidinfo.it
Subject Re: Does closing a Connection variable and setting it to null close all of the ResultSet and Statements?
Date Wed, 28 Aug 2002 11:45:35 GMT

Unfortunately there are databases and JDBC combinations, that do not free
database resources, if you do not explicitely close all result sets and
statements. If i remember right, SAP DB was one of them (BTW, only problem
i had with it, and easy to resolve). You may then run out of connections,
because the database did not free the connection until there were open
result sets. I am quite sure, that this may apply to other databases, too,
and i got used to explicitely close everything (i wrote my own wrapper
classes for connections and statements, which ease these tasks).

Regards,

Jens Stutte



                                                                                         
           
                    Glenn Nielsen                                                        
           
                    <glenn@mail.m        To:     Tomcat Users List <tomcat-user@jakarta.apache.org>
 
                    ore.net>             cc:                                          
              
                                         Subject:     Re: Does closing a Connection variable
and     
                    28/08/2002           setting it to null close all of the ResultSet and
          
                    02.03                Statements?                                     
           
                    Please                                                               
           
                    respond to                                                           
           
                    "Tomcat Users                                                        
           
                    List"                                                                
           
                                                                                         
           
                                                                                         
           




Per the javax.sql javadocs...

When a Connection is closed it closes any open Statements.
When a Statement is closed, it closes any open ResultSets.

If you just dereference a connection (non connection pool) when the
Connection is GC'd it is closed.

If you use DBCP 1.0 as your connection pool it tracks Statements and
ResultSets used
by a connection.  When you close the connection it will ensure the
Statements and ResultSets
still open for that Connection are closed.

Regards,

Glenn


Michael Nicholson wrote:
> 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
to null) all statements and recordsets too?  Right now the system takes
about 4% of my available memory just for the beans in question, so I'm
trying to minimize what I store so that I could conceptually have more than
one user.
>
> Thanks in advance,
> Mike Nicholson




--
To unsubscribe, e-mail:   <
mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:tomcat-user-help@jakarta.apache.org>






--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message