aspose file tools*
The moose likes JDBC and the fly likes Q about JDBC driver classes: how many open cursors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Q about JDBC driver classes: how many open cursors" Watch "Q about JDBC driver classes: how many open cursors" New topic
Author

Q about JDBC driver classes: how many open cursors

Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 975
Hi,

Is there a way to find out how many open
database cursors there are with the JDBC
driver classes?

I need this info to investigate the cause
of an Oracle problem regarding the use of
too many cursors.

Cheers,

Gian Franco


"Eppur si muove!"
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
There isn't. But I can tell you what your cursor problem is - been there, done that, got the tar and feathers - it's a resource leak. Somewhere in your code (or a library you use) JDBC Statement objects are not being closed. The Oracle driver does not seem to clean up unclosed statements; maybe the Connection keeps a reference to them, or they don't have a finalize method. If you are using a connection pool this means the Statement, and all its open result sets, stays around forever. Eventually you will run out of cursors.

Be religious about closing all your statements and connections in a finally clause.

- Peter
 
 
subject: Q about JDBC driver classes: how many open cursors
 
Similar Threads
maximum opened cursors exeeded
too many open cursors
JDBC Cursor Error
Reagarding ResultSet Close in a Thread
PreparedStatement's - how do you use them CORRECTLY?