Problem solved. I got wrong coding.
I've two db connections, set auto commit false using second db
connection, but doing insert record transaction using the first db
connection.
thx u.


On Dec 7, 4:16 am, Knut Wannheden <[email protected]> wrote:
> Could it be that your connection has auto commit enabled? That's what it 
> looks like...
>
> Regards
>
> Knut
>
> On Dec 6, 2011, at 10:25, satio <[email protected]> wrote:
>
>
>
>
>
>
>
> > the commit never called because on second query is already error
> > (cause there is no table "products2").
> > When error in second query, it already enter to Exception.. (commit
> > wouldn't executed).
>
> > Correct me if i'm wrong.
> > satio
>
> > On Dec 6, 3:13 pm, Noel Grandin <[email protected]> wrote:
> >> depends where the rollback occurred. If the rollback occurred after the 
> >> commit, then it won't have any effect.
>
> >> satio wrote:
> >>> Hello..
> >>> I tried using connection pool in my ram DB..
> >>> if i dont't use beginTransaction, it seems no problem.
> >>> But when i use beginTransaction using connection pool in my ram DB,
> >>> i got a problem that the transaction didn't work at all.
>
> >>> Here my code to get connection pool in ram:
> >>> JdbcConnectionPool cpool =
> >>> JdbcConnectionPool.create("jdbc:h2:mem:db_ram", "", "");
>
> >>> BEGIN TRANSACTION
> >>> try {
> >>> //       insert record to ramDB
> >>>          insert into Products(product_id, product_name) VALUES (1,
> >>> "SNACK");     --> table Products is exists
> >>>          insert into Products2(product_id, product_name) VALUES (2,
> >>> "POTATO");  --> table Products2 isn't exists
>
> >>>         COMMIT
> >>> } catch(Exception e) {
> >>>         ROLLBACK
> >>> }
>
> >>> NB : assume above code is correct
>
> >>> The Result is :
> >>> The Product Name "SNACK" is inserted to ram DB  --> (the rollback
> >>> didn't work at all)
>
> >>> Is beginTransaction not allowed in connection pool at memory
> >>> database??
>
> >>> satio
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "H2 Database" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/h2-database?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to