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 Gin Ng <gi...@ca.ibm.com> on 2005/06/03 21:00:50 UTC

Rollback problem

I have a table which is referenced by several other tables. When I turn
autocommit off, do the inserts to the tables and rollback. All inserts are
rolled back except the parent table. Anyone has encountered the problem?

Gin Ng


Re: Rollback problem

Posted by Gin Ng <gi...@ca.ibm.com>.
Thanks Mike for pointing out there is a way to print out the queries. From
derby.log, I can see the program issued an unexpected commit while trying
to mimic a DB2/Oracle feature. It is not a derby problem.

Gin Ng



                                                                           
             Mike Matrigali                                                
             <mikem_app@sbcglo                                             
             bal.net>                                                   To 
                                       Derby Discussion                    
             06/03/2005 07:31          <de...@db.apache.org>          
             PM                                                         cc 
                                                                           
                                                                   Subject 
             Please respond to         Re: Rollback problem                
                  "Derby                                                   
                Discussion"                                                
                                                                           
                                                                           
                                                                           
                                                                           




This is going to show my predjudice about the recovery code, but at
least as described this seems so simple that I think there must be
something tricky going on.

To diagnose the issue you should enable the property to print all
queries to the derby.log, so that we can see if there is an unexpected
commit.  If you can't find appropriate documentation on list or in docs
let the list know.

Definitely check how you are setting autocommit and make sure same
connection is used to do first insert and subsequent inserts - as
autocommit can be set on a per connection basis.  Maybe good to describe
how you are turning autocommit off.

Mamta Satoor wrote:
> Hi Gin,
>
>  From your description, it sounds like it might be a bug in Derby,
> especially, since it works with other databases. A reproducible program
> will definitely help establish that.
>
> Mamta
>
>
> On 6/3/05, *Gin Ng* <ginng@ca.ibm.com <ma...@ca.ibm.com>> wrote:
>
>     The code is just several inserts and then an explicit rollback. All
>     inserts
>     are successful, no SQL exception. The program is a unit test case
which
>     does some database operations and then rollback the transaction to
>     get the
>     database back to the known state. The same program works with DB2 and
>     Oracle.
>
>     I cannot post the schema because it is quite big and complex. I have
>     been
>     trying to come up with a smaller test case to illustrate the
>     problem, but
>     still without succeed so far.
>
>     Thanks,
>     Gin Ng
>
>
>
>
>
>                 Sunitha
>                 Kambhampati
>                 <
>     ksunithaghm@gmai                                          To
>                 l.com <http://l.com>>                    Derby Discussion
>                                           < derby-user@db.apache.org
>     <ma...@db.apache.org>>
>                 06/03/2005
>     03:38                                           cc
>                 PM
>
Subject
>                                           Re: Rollback problem
>                 Please respond to
>                      "Derby
>                    Discussion"
>
>
>
>
>
>
>
>     Gin Ng wrote:
>
>      >I have a table which is referenced by several other tables. When I
>     turn
>      >autocommit off, do the inserts to the tables and rollback. All
>     inserts are
>      >rolled back except the parent table. Anyone has encountered the
>     problem?
>      >
>      >Gin Ng
>      >
>      >
>      >
>      >
>     Can you provide more details on what you are trying to do  so we can
>     figure out what is happening. Is there a chance you could post code
that
>     shows this behavior ?
>     Also are you issuing an explicit rollback call or  did an sql
statement
>     generate an exception .
>
>     Thanks,
>     Sunitha.
>
>
>




Re: Rollback problem

Posted by Mike Matrigali <mi...@sbcglobal.net>.
This is going to show my predjudice about the recovery code, but at 
least as described this seems so simple that I think there must be 
something tricky going on.

To diagnose the issue you should enable the property to print all
queries to the derby.log, so that we can see if there is an unexpected
commit.  If you can't find appropriate documentation on list or in docs
let the list know.

Definitely check how you are setting autocommit and make sure same
connection is used to do first insert and subsequent inserts - as 
autocommit can be set on a per connection basis.  Maybe good to describe
how you are turning autocommit off.

Mamta Satoor wrote:
> Hi Gin,
>  
>  From your description, it sounds like it might be a bug in Derby, 
> especially, since it works with other databases. A reproducible program 
> will definitely help establish that.
>  
> Mamta
> 
>  
> On 6/3/05, *Gin Ng* <ginng@ca.ibm.com <ma...@ca.ibm.com>> wrote:
> 
>     The code is just several inserts and then an explicit rollback. All
>     inserts
>     are successful, no SQL exception. The program is a unit test case which
>     does some database operations and then rollback the transaction to
>     get the
>     database back to the known state. The same program works with DB2 and
>     Oracle.
> 
>     I cannot post the schema because it is quite big and complex. I have
>     been
>     trying to come up with a smaller test case to illustrate the
>     problem, but
>     still without succeed so far.
> 
>     Thanks,
>     Gin Ng
> 
> 
> 
> 
> 
>                 Sunitha
>                 Kambhampati
>                 <
>     ksunithaghm@gmai                                          To
>                 l.com <http://l.com>>                    Derby Discussion
>                                           < derby-user@db.apache.org
>     <ma...@db.apache.org>>
>                 06/03/2005
>     03:38                                           cc
>                 PM
>                                                                       Subject
>                                           Re: Rollback problem
>                 Please respond to
>                      "Derby
>                    Discussion"
> 
> 
> 
> 
> 
> 
> 
>     Gin Ng wrote:
> 
>      >I have a table which is referenced by several other tables. When I
>     turn
>      >autocommit off, do the inserts to the tables and rollback. All
>     inserts are
>      >rolled back except the parent table. Anyone has encountered the
>     problem?
>      >
>      >Gin Ng
>      >
>      >
>      >
>      >
>     Can you provide more details on what you are trying to do  so we can
>     figure out what is happening. Is there a chance you could post code that
>     shows this behavior ?
>     Also are you issuing an explicit rollback call or  did an sql statement
>     generate an exception .
> 
>     Thanks,
>     Sunitha.
> 
> 
> 


Re: Rollback problem

Posted by Mamta Satoor <ms...@gmail.com>.
Hi Gin,
 From your description, it sounds like it might be a bug in Derby, 
especially, since it works with other databases. A reproducible program will 
definitely help establish that.
 Mamta

 On 6/3/05, Gin Ng <gi...@ca.ibm.com> wrote: 
> 
> The code is just several inserts and then an explicit rollback. All 
> inserts
> are successful, no SQL exception. The program is a unit test case which
> does some database operations and then rollback the transaction to get the
> database back to the known state. The same program works with DB2 and
> Oracle.
> 
> I cannot post the schema because it is quite big and complex. I have been
> trying to come up with a smaller test case to illustrate the problem, but
> still without succeed so far.
> 
> Thanks,
> Gin Ng
> 
> 
> 
> 
> 
> Sunitha
> Kambhampati
> <ksunithaghm@gmai To
> l.com <http://l.com>> Derby Discussion
> <de...@db.apache.org>
> 06/03/2005 03:38 cc
> PM
> Subject
> Re: Rollback problem
> Please respond to
> "Derby
> Discussion"
> 
> 
> 
> 
> 
> 
> 
> Gin Ng wrote:
> 
> >I have a table which is referenced by several other tables. When I turn
> >autocommit off, do the inserts to the tables and rollback. All inserts 
> are
> >rolled back except the parent table. Anyone has encountered the problem?
> >
> >Gin Ng
> >
> >
> >
> >
> Can you provide more details on what you are trying to do so we can
> figure out what is happening. Is there a chance you could post code that
> shows this behavior ?
> Also are you issuing an explicit rollback call or did an sql statement
> generate an exception .
> 
> Thanks,
> Sunitha.
> 
> 
>

Re: Rollback problem

Posted by Gin Ng <gi...@ca.ibm.com>.
The code is just several inserts and then an explicit rollback. All inserts
are successful, no SQL exception. The program is a unit test case which
does some database operations and then rollback the transaction to get the
database back to the known state. The same program works with DB2 and
Oracle.

I cannot post the schema because it is quite big and complex. I have been
trying to come up with a smaller test case to illustrate the problem, but
still without succeed so far.

Thanks,
Gin Ng




                                                                           
             Sunitha                                                       
             Kambhampati                                                   
             <ksunithaghm@gmai                                          To 
             l.com>                    Derby Discussion                    
                                       <de...@db.apache.org>          
             06/03/2005 03:38                                           cc 
             PM                                                            
                                                                   Subject 
                                       Re: Rollback problem                
             Please respond to                                             
                  "Derby                                                   
                Discussion"                                                
                                                                           
                                                                           
                                                                           




Gin Ng wrote:

>I have a table which is referenced by several other tables. When I turn
>autocommit off, do the inserts to the tables and rollback. All inserts are
>rolled back except the parent table. Anyone has encountered the problem?
>
>Gin Ng
>
>
>
>
Can you provide more details on what you are trying to do  so we can
figure out what is happening. Is there a chance you could post code that
shows this behavior ?
Also are you issuing an explicit rollback call or  did an sql statement
generate an exception .

Thanks,
Sunitha.



Re: Rollback problem

Posted by Sunitha Kambhampati <ks...@gmail.com>.
Gin Ng wrote:

>I have a table which is referenced by several other tables. When I turn
>autocommit off, do the inserts to the tables and rollback. All inserts are
>rolled back except the parent table. Anyone has encountered the problem?
>
>Gin Ng
>
>
>  
>
Can you provide more details on what you are trying to do  so we can 
figure out what is happening. Is there a chance you could post code that 
shows this behavior ? 
Also are you issuing an explicit rollback call or  did an sql statement 
generate an exception .

Thanks,
Sunitha.