You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Leszek Gawron <ou...@kompuart.pl> on 2002/07/23 09:25:29 UTC

Esql and rollback

I'm quite new to JDBC and ESQL. My question is: I have more that one database
inserts. Every one in different esql:execute tag. How can I rollback the
transaction if say the 3rd goes wrong? There is no such esql tag and I do not
know how to obtain the appropriate jdbc session variable? or maybe I'm totally
wrong?
	ouzo
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Esql and rollback

Posted by yuryx <yu...@mobicomk.donpac.ru>.
Leszek Gawron wrote:

>I'm quite new to JDBC and ESQL. My question is: I have more that one database
>inserts. Every one in different esql:execute tag. How can I rollback the
>transaction if say the 3rd goes wrong? There is no such esql tag and I do not
>know how to obtain the appropriate jdbc session variable? or maybe I'm totally
>wrong?
>	ouzo
>  
>
Open the new  connection like:
<esql:connection>
 <esql:driver>mydriver</esql:driver>
 <esql:dburl>dburl</esql:dburl>
 <esql:username>... </esql:username>
 <esql:password>...</esql:password>

And set <esql:autocommit>false</esql:autocommit> in your connection.

Now you can use following syntax to commit or rollback changes:

<esql:execute-query>
 ... put your query here
</esql:execute-query>
<esql:execute-query><esql:query>commit (or rollback) 
</esql:query></esql:execute-query>
</esql:connecton>

May be that example solve your problem :)
 (Because I doesn't try this method in my work)

Regards.
Yury.



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Esql and rollback

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 23.Jul.2002 -- 09:25 AM, Leszek Gawron wrote:
> I'm quite new to JDBC and ESQL. My question is: I have more that one database
> inserts. Every one in different esql:execute tag. How can I rollback the
> transaction if say the 3rd goes wrong? There is no such esql tag and I do not
> know how to obtain the appropriate jdbc session variable? or maybe I'm totally
> wrong?

Set connection to autocommit false, start transaction with "begin
transaction" and do "rollback work" or "commit work" as
appropriate. The above depends on your DBMS and various DBMS
settings.

There has been a post regarding esql and autocommit recently, but I've
just returned from a short vaccation and haven't looked at this (and
other) issues, yet.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>