That wording is being removed from the JDBC 4 spec as it is impossible to enforce and no driver vendor can make sure it happens.


Wei Jiang wrote:
java.sql javadoc says:

Note: A Statement object is automatically closed when it is garbage collected.
When a Statement object is closed, its current ResultSet object, if one exists,
is also closed.

I do not close ResultSet. But I do close Statement. Is it possible that
when derby's Statement closed, the ResultSet is not?

I did forget to close one statement. After a while, Oracle's coneection 
automatically closed, so I found the problem and closed that statement after
use. Here, I am not trying to compare oracle with derby, but trying to say
that PROBABALY I close all Statement.


From: Dyre.Tjeldvoll@Sun.COM

Wei Jiang <> writes:


I tried Derby using the default JDBC driver and found memory leak. When I use
Hsql or Oracle, I do not have such leak. So probably it is the JDBC driver.

Two things:

1) Are you closing your ResultSets? If just let the ResultSet objects
   pass out of scope without closing them, they will be "leaked". That
   is, the driver keeps a linked list of them so they won't be
   gc'ed. I have experienced this myself, but I don't know if there is
   a JIRA issue for it

2) Are you using blobs/clobs? From what I have seen on this (and the
   derby-dev) list, it seems that blobs/clobs cannot be streamed, and this
   can result in "Out of Memory" errors when using large blobs/clobs.

Click here to donate to the Hurricane Katrina relief effort.