Re: open_cursors question

  • From: "Richard Ji" <richard.c.ji@xxxxxxxxx>
  • To: Mark.Bobak@xxxxxxxxxxxxxxx
  • Date: Mon, 31 Jul 2006 11:46:51 -0400

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@xxxxxxxxxxxxxxx> 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
--
//www.freelists.org/webpage/oracle-l


Other related posts: