Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: open_cursors question

Re: open_cursors question

From: Richard Ji <richard.c.ji_at_gmail.com>
Date: Mon, 31 Jul 2006 11:46:51 -0400
Message-ID: <b4d52f20607310846x74158630tdff4d8192aec1158@mail.gmail.com>


I have encountered this with other developers before. Yes, they were closing ResultSet, Statement and Connection objects. But the question is, where? Are they cleaning things up right after finish using it? All it takes is a nested loop of two ResultSet:

while (rset1.next()) {
  while (rset2.next() {
  }
}
rset1.close();
rset2.close();

All it takes is rset1 return 50 rows and rset2 return 100 rows, and your 5000 open cursors are done.

They should, of course do:
while (rset1.next()) {
  while (rset2.next()) {
  }
  rset2.close();
}
rset1.close();

Best regards,

Richard Ji

On 7/28/06, Bobak, Mark <Mark.Bobak_at_il.proquest.com> wrote:
>
>
> Sandy,
>
> I'm a DBA, not a Java developer, but, as I recall, not only does the
> developer need to close the resultset, but also the statement. (Using the
> stmt.close() method.)
>
> A bit of info is available in MetaLink Doc ID 118756.1, Oracle JDBC
> Frequently Asked Questions.
>
> Hope that helps,
>
> -Mark
>
> --
> Mark J. Bobak
> Senior Oracle Architect
> ProQuest Information & Learning

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Jul 31 2006 - 10:46:51 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US