Reuse of cursors in JDBC
Rizwan Qazi, May 24, 2004 - 9:11 am UTC
Tom,
In your statement: "The application would, prior to parsing, look up the statement in the hash table. If not found, then parse and add -- else reuse." I suppose by hash table here you mean the one with "persistent" statments, right?
Also, I am not still too clear about the hash table with "session only" statements. Will it be used only by the current session/transaction; because you say that it should be iterated and all CURSORS within it closed before returning the connection. In that case you mean your initial statement of "parse and add -- else reuse" will mean that we add the "not found" cursor to both the hash tables (persistent as well as session). Please comment.
May 24, 2004 - 9:17 am UTC
the application would have to decide whether it was going to look in the session or persistent hash table if it was using both.
I'm just saying "might be nice to have two hash tables -- one that has cursors that live for the life of the connection -- all users reuse over and over, another for cursors that the developer reasonably expects are somewhat "unique" and will not be reused very much if at all"
you decide which to use.
Reuse of cursors in JDBC
A reader, May 24, 2004 - 9:24 am UTC
Reuse of cursors in JDBC
Rizwan Qazi, May 24, 2004 - 9:24 am UTC
JDBC 3.0 Reuse of PreparedStatement (caching)
Alberto Dell'Era, May 24, 2004 - 12:49 pm UTC
Perhaps what you want is already implemented ?
Don't know whether it will survive in a connection pool ... but it may be worth a look (it's similar to the session cursor cache but on the client side afaik, never used it yet).
</code>
http://otn.oracle.com/products/oracle9i/daily/jun24.html <code>
hth
Alberto
May 24, 2004 - 1:11 pm UTC
thanks very much -- that looks exactly like what I described :) awesome.
Reuse of cursors in JDBC
Rizwan Qazi, May 24, 2004 - 2:18 pm UTC
Closing JDBC cursor areas
Wayne, November 24, 2008 - 3:44 pm UTC
Tom,
I am researching a colleague's problem with jdbc causing cursor leaks in their application.
They are using jdbc as connection pooling and closing the session would impact more than one user.
Is there a way for me (DBA) to close open cursors in a session without closing the session? Is there a dbms package that I could use to close cursors in a session?
Thanks
Wayne
Thanks
Wayne
November 24, 2008 - 7:50 pm UTC
jdbc doesn't cause cursor leaks.
programmers cause cursor leaks.
why would you try to fix a bad program bug with a sledge hammer - many cursors SHOULD stay open (you need to parse a cursor at least ONCE and at MOST once)
You could seriously break stuff by closing cursors (someone might have coded things properly, they sort of expect their stuff to be there...)
http://docs.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sessio.htm#i1010767