This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Open Cursors:New Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Open Cursors:New Issue" Watch "Open Cursors:New Issue" New topic
Author

Open Cursors:New Issue

Bob Mathews
Ranch Hand

Joined: Feb 26, 2006
Posts: 43
Hi all Ranchers
I m facing a very peculiar problem in my application

We take connection object fro the connection pool
Do the processings::
Open resultSet
Fire queries
But the resultset is kept open
AND WE HAVE RETURNED THE CONNECTION TO THE POOL
Now the problem is that it ius not possible for us to pit rs.close()
Secondly there are Cursors that are opened automatically with the resultset and as the resultset is not closed they remain open
And thus the cursor remain open and become dangling
So do we have a way to close the dangling cursor created by the system

Please reply fast its urgent
[ October 16, 2006: Message edited by: Bear Bibeault ]
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3700
    
    5

Odd... very... why can't you use rs.close()? Can you end transactions? Can you force connections to be closed?

Maybe if you gave us more information about your database server, web server, and why you have open cursors.


My Blog: Down Home Country Coding with Scott Selikoff
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

Originally posted by Nishant Tiwari:
Now the problem is that it ius not possible for us to pit rs.close()

Why not? Can you show the code to illustrate why it is not possible. I'm having trouble visualizing any case where a finally block wouldn't work.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bob Mathews
Ranch Hand

Joined: Feb 26, 2006
Posts: 43
See this is a production issue and the people who have developed it have not put that rs.close
Now if we start placing rs.close people are estimating it will take weeks to put it inplace and test it

I know situation and condition seemed awkward but please help it out

Just think of some alternative solution of closing the open cursor without rs.close


Thanks
It will be of great help
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3700
    
    5

Aside from periodically restarting the application, its hard to make up for bad coding with a hack.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

Nishant,
As this is coding issue, it is hard to fix without a coding solution. I can't think of any way to "magically" close the cursors apart from restarting the application.

On a side note, it shouldn't take weeks for an emergency production fix. Maybe you can do a compare to show them only the rs.close() has changed?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open Cursors:New Issue
 
Similar Threads
Closing of connection object in Stateless Session Beans
Open Cursor Exceeded in Oracle
ResultSet after DB closed
JDBC connection pool
how to close unused open cursors