This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc 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 "jdbc" Watch "jdbc" New topic


namrata rane

Joined: Aug 02, 2001
Posts: 1
I am using preparedStatement to execute some queries .
and inspite of closing result, statement i am getting
"maximum cursors open exceeded".
What can be the reason?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

If Oracle it your database, This might help:
even after resultset.close(), statement.close(),resultset = null and statement=null, all cursors were not being closed in the DB. A service call in to oracle seemed to imply that there were some bugs in their jdbc implementations - any Statement you created would internally spawn cursors in the db (from their drivers) that weren't getting closed. apparently this has been fixed in the 8.1.7 release, I still found that we needed to set our open_cursors (in init.ora, on the db server) to a fairly high number (i think default is 40 or something), and do a forced conn.rollback() every time we returned the Connection interface object back to our connection pool.
another way to clean up the cursors is to close the connection. But this process is too time consuming for our implementation.
seemed to help... but not totally solve
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
if you use prepared statments it will reuse the cursors
Consider Paul's rocket mass heater.
subject: jdbc
Similar Threads
Word Games
are you guys all aquiver?
Who am I?
design question
Completed SCEA(II/III) . i.e. Now all 4 Sun Java Certifications are complete.