Re: how do i start and end a transaction with hsqlb?

Jorge Garcia de Alba <[email protected]> Sun, 5 May 2019 05:31:14 -0500
Newsgroups gmane.comp.java.hsqldb.user
Message-ID <CAEVgvV8bXHB97t=+7v8QY3Lb+5wqaiwSsYLXJSBQaAhWgv7eiw@mail.gmail.com>
When I use connection.setAutoCommit(false), run my procedures and
cause an exception it is not rolling back so I was wondering if I
missed a configuration setting or something.

On 5/5/19, Fred Toussi via Hsqldb-user
<[email protected]> wrote:
> A transaction is started when you execute the first insert, update or delete
> statement or procedure. The connection.commit() call commits the
> transaction. A connection.rollback() rolls it back to the start of the
> transaction.
>
> You just connect to your HSQLDB database to obtain your java.sql.Connection
> object and run your code. HSQLDB is always transaction but you can change
> the details if you want to. See the Guide, Sessions and Transactions
> chapter.
>
> Fred Toussi
>
> On Sun, May 5, 2019, at 03:41, Jorge Garcia de Alba wrote:
>> Hello,
>>
>> I would like to run a batch of statements and/or procedures and if
>> there is an exception rollback.
>>
>> Something like:
>>
>>    try
>>         {
>>             connection.setAutoCommit(false);
>>             //insert, update, delete statements and/or procedures
>>             connection.commit();
>>         }
>>         catch (Exception e)
>>         {
>>             connection.rollback();
>>         }
>>
>> How do I setup hsqldb to do this?
>>
>> jr
>>
>>
>> _______________________________________________
>> Hsqldb-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/hsqldb-user
>>
>
>
> _______________________________________________
> Hsqldb-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hsqldb-user
>