db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject Re: Incomplete transactions on recovery (embedded)
Date Mon, 05 Feb 2007 17:46:19 GMT
Tim, I am not sure either why is your incomplete transaction not getting
rolled back. I tried a very simple test case in ij and was able to confirm
the partial transaction rollback. Here is what I did

Start a transaction and insert some rows but Ctrl-C out of it so the
transaction should be marked incomplete.

$ java org.apache.derby.tools.ij
ij version 10.3
ij> connect 'jdbc:derby:c:/dellater/db1';
ij> select * from t1;
C11
-----------

0 rows selected
ij> autocommit off;
ij> insert into t1 values (1),(2);
2 rows inserted/updated/deleted
ij>
$

I Ctrl-Ced out of the ij session above. Later, in the following ij session,
when I do select * from t1, I don't see the rows from the partial
transaction above.
$ java org.apache.derby.tools.ij
ij version 10.3
ij> connect 'jdbc:derby:c:/dellater/db1';
ij> select * from t1;
C11
-----------

0 rows selected
ij> exit;
$
So, I am not sure why you don't see the same behavior with your partial
transaction. Do you have a simple reproducible test case?

Mamta


On 2/5/07, Tim Gleason <tgleason@gmail.com> wrote:
>
> I'm doing something I think is pretty simple, but I'm getting
> unexpected results.  After a few hours of googling, I still don't
> understand what I don't understand ;)  So, I'm sorry for spamming this
> list if this is a dumb question.
>
> I'm using derby via embedded JDBC.  I do a bunch of work in a single
> transaction, then commit.  If the system fails during the operation of
> a single transaction, I expect a rollback on system restart (for
> embedded, I /assume/ that means once I've connected to the db again --
> but this might be my problem).
>
> In testing my system, I killed the process in the middle of the
> transaction.  On restart, I expected all of the work done in that
> (partial) transaction to be removed.  But it wasn't.  The affects were
> still there -- and visible to a new transaction.  This is not what I
> would expect.
>
> Is there something specific that needs to be done to force derby to
> roll back incomplete transactions?  Is this specific to embedded
> derby?  Is there something simple I'm missing?  [In case anyone
> wonders, yes I did set autocommit to false on the JDBC connection.]
>
> Thanks for your help,
> tim
>

Mime
View raw message