Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JDBC and the fly likes maximum open cursor exceeded in java batch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "maximum open cursor exceeded in java batch" Watch "maximum open cursor exceeded in java batch" New topic

maximum open cursor exceeded in java batch

Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 88
Hi all,

I have an issue when run the java batch, it return maximum cursor exceeded error.

here is the flow of code,

1.Created static connection the query in main method with this connection
3.The query return more than 1000 rows, but cursor maximum size is 1000.(i do not want to increase the cursor size)
4. i close the connection after each row performed some task.
5. But its not take any affect since the connection variable is static.

Could anyone suggest to correct this issue


Martin Vajsar

Joined: Aug 22, 2010
Posts: 3606

Don't know what database you're on, but generally the maximum open cursor limit does not limit number of rows you can read from a database. Instead, it limits number of statements that can be simultaneously processed.

Your point 4 looks suspicious to me. You should not close the connection until you're completely done with it. On the other hand, you should close the statement and resultset when you finish using it (but again, not sooner). Not closing the statement/resultset probably would cause the error you're experiencing, so check this.

By the way, a connection gets closed by calling the close() method. Regardless of whether the variable is static or not, this does close the connection.

If you post the code, you'll probably get better response than this one. We need to see what's really happening there.
jQuery in Action, 2nd edition
subject: maximum open cursor exceeded in java batch
Similar Threads
ORA-01000: maximum open cursors exceeded
Glassfish Connection Pooling
ORA-01000 maximum open cursors exceeded
MAX cursor exceeded error after Migration from WAS4 to WAS5.1
Issue after Migration from WAS4 to WAS5.1