Subject | Re: Newbie Question: How do I create a transaction using JAVA+IB? |
---|---|
Author | lapc2000br |
Post date | 2002-01-30T22:57:18Z |
Sorry man.
I've tried a lot of combinations but nothing worked.
Can somebody send me an example?
Thanx.
I've tried a lot of combinations but nothing worked.
Can somebody send me an example?
Thanx.
--- In IB-Java@y..., "A Bazin" <abazin@h...> wrote:
> Have you checked to see if the:
>
> conn.rollback();
>
> is raising an exception? Your example is catching it but not doing
anything
> with it.
>
> ----- Original Message -----
> From: "lapc2000br" <leofree@b...>
> To: <IB-Java@y...>
> Sent: Wednesday, January 23, 2002 7:32 PM
> Subject: [IB-Java] Newbie Question: How do I create a transaction
using
> JAVA+IB?
>
>
> > Hi,
> >
> > I'm trying to create a transaction using JAVA+IB but I'm not
having
> > any success. I've tried:
> >
> > //BEGIN TRANS
> > try {
> > conn.setAutoCommit(false);
> > conn.commit();
> > } catch (SQLException e) {}
> >
> > //THE TRANS ITSELF
> > try {
> > Statement stmt1, stmt2;
> >
> > stmt1 = conn.createStatement();
> > stmt1.executeUpdate("UPDATE..."));
> > stmt1.close();
> >
> > stmt2 = conn.createStatement();
> > stmt2.executeUpdate("UPDATE..."));
> > stmt2.close();
> > } catch (SQLException e)
> > {
> > try {
> > conn.rollback();
> > } catch (SQLException e2) {
> > }
> > }
> >
> > //END TRANS
> > try {
> > conn.commit();
> > conn.setAutoCommit(true);
> > } catch (SQLException e) {}
> >
> > The problem occurs when the stmt1 is successful but stmt2 is NOT.
> > The transaction is NOT rolled back!
> >
> > Can u help me?
> >
> > Leo Cavalcanti.
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > IB-Java-unsubscribe@e...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >