You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by "John C. Turnbull" <oz...@ozemail.com.au> on 2007/07/31 19:04:48 UTC
Transaction control in Derby
I am new to Derby and I'm wondering how does one do transaction management?
I have looked through the reference manual and there doesn't appear to be
any BEGIN TRANSACTION or ROLLBACK statements mentioned there. How do I
execute a series of statements as a proper transaction with the ability to
rollback the entire thing if need be?
Thanks,
John C. Turnbull
Re: Transaction control in Derby
Posted by David Van Couvering <da...@vancouvering.com>.
You can use the JDBC apis. You can use connection.setAutoCommit() to
enable or disable autocommit. If autocommit is on, then every time
you execute a statement it is executed. If autocommit is off, then a
transaction is started automatically when you executed the first
statement, and you need to use connection.commit() or
connection.rollback() to commit or roll back a transaction. Note
there is also support for savepoints.
This is the portable way to do transaction control using JDBC.
David
On 7/31/07, John C. Turnbull <oz...@ozemail.com.au> wrote:
>
>
>
>
> I am new to Derby and I'm wondering how does one do transaction management?
> I have looked through the reference manual and there doesn't appear to be
> any BEGIN TRANSACTION or ROLLBACK statements mentioned there. How do I
> execute a series of statements as a proper transaction with the ability to
> rollback the entire thing if need be?
>
>
>
> Thanks,
>
>
>
> John C. Turnbull
>
>