Two Laptop Bag
The moose likes JDBC and the fly likes Rogue Cursors in Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Rogue Cursors in Oracle" Watch "Rogue Cursors in Oracle" New topic
Author

Rogue Cursors in Oracle

M Robinson
Greenhorn

Joined: Jul 25, 2001
Posts: 1
We are calling a variety of Stored procedures from a servlet running on WebLogic. We are periodically receiving Max cursor open errors during our testing, even though we are the only client accessing the server. We have placed all of the relevant close calls (ResultSets, Statements and Connnections) in finally clauses for the relevant methods and we are sure they are being closed. We have looked in our WLS connection pool and there are no open connections after our close calls have been made. However, if we interrogate the database for open cursors, we see all of our calls still active. Does anyone have any suggestions regarding next steps.
Thanks in advance!!!
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

1. Search for all statements and resultsets and make sure they all get closed!
After you have made sure that #1 isn't the culprit, Oracle has some internal problems with prepared statements. On some occasions, even though you close the resultset and prepared statements, the cursors remain open. Soon you will get "Ora-1000 max number of cursors exceeded" or something to that effect. There are 3 workarounds:
2. set max number of open cursors in Oracle to a high number (at least 200... the default is 40ish) as this does not effect performance of the DB.
3. force a rollback: connection.rollback()
4. close the connection: connection.close()
hope this helps
NOTE: try updating your jdbc drivers to the latest ( and most bug free ) drivers possible.
Jamie
[ July 30, 2002: Message edited by: Jamie Robertson ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Rogue Cursors in Oracle
 
Similar Threads
ORA-01000: maximum open cursors exceeded
Result Set
Need some idea on how to determine the no. of SQL connections that is left open(all across the apln)
Detecting Connection leaks
Properties File For Oracle