Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JDBC rollback closes ResultSet

69 views
Skip to first unread message

Gregor Kovač

unread,
Jan 27, 2009, 3:22:05 AM1/27/09
to
Hi!

In my application I see a strange behavior. Whenever I rollback a
transaction, all ResultSets are closes. My Connection has auto commit
set to off.
The JDBC javadoc
(http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#rollback())
only says that rollback releases all database locks, nothing about
releasing resources.

Any pointers?

Best regards,
Kovi

joe.we...@gmail.com

unread,
Jan 27, 2009, 11:11:11 AM1/27/09
to

Depending on the DBMS, transaction isolation level, and the type of
result set, it may well hold DBMS locks. I suggest looking into
rowsets if you want to maintain the query results indefinitely.
Joe

Mark A

unread,
Jan 27, 2009, 5:17:21 PM1/27/09
to
On Jan 27, 12:22 am, Gregor Kovač <gregor.ko...@mikropis.si> wrote:
> Hi!
>
> In my application I see a strange behavior. Whenever I rollback a
> transaction, all ResultSets are closes. My Connection has auto commit
> set to off.
> The JDBC javadoc
> (http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#rollback())
> only says that rollback releases all database locks, nothing about
> releasing resources.
>
> Any pointers?
>
> Best regards,
> Kovi

Using regular SQL, whenever you do a commit, by default all cursors are
closed in DB2. You can override that by opening a cursor using the "WITH
HOLD" option. But I don't know how that is controlled in JDBC.


Gregor Kovač

unread,
Jan 28, 2009, 2:46:56 AM1/28/09
to
Hi!

The strange thing is that if I do a commit, ResultSet stay opened.

Best regards,
Kovi

Mark A pravi:

0 new messages