Re: 2 Different Database Transactions
Posted in 2004
Topics: General Discussion
That's OK. I got it by doing as follows:
begin work;
insert into db1@server1:tab1 values ...update db2@server2:tab2 set ...
commit work;
Cheers,
Dorn.
----- Original Message -----
From: "Dorn Bhechsonggram" <dorn@bakcommunications.com>
To: "informix-list" <informix-list@iiug.org>
Sent: Monday, March 01, 2004 02:04 PM
Subject: 2 Different Database Transactions
> I just wonder whether anyone can give me some recommendations.
>
> If I need to execute the query in 2 different databases as follows:
>
> --1st connection
> begin work;
> insert into table1 value ('x');>
> --2nd connection
> update table2 set column1 = columns2;> commit work;
>
> I want both transaction to complete and then commit.
> My question is whether I can issue just 1 BEGIN WORK/COMMIT WORK for both
> connection and it will commit for both queries.
>
> I am not sure if I explain clearly. Please let me know.
>
> Thank you.
> Dorn.
>
>
> sending to informix-list
sending to informix-list
Dorn Bhechsonggram wrote:
> That's OK. I got it by doing as follows:
>
> begin work;
> insert into db1@server1:tab1 values ...> update db2@server2:tab2 set ...
> commit work;
Yes that's the best way.
You couldn't do it the other way without somehow starting an XA-style
transaction, and having both connections associated with the same
GTRID (global transaction ID). That can be done in C (ESQL/C). I
don't think it can be done in DB-Access or friends.
> ----- Original Message -----
> From: "Dorn Bhechsonggram" <dorn@bakcommunications.com>
>
>>I just wonder whether anyone can give me some recommendations.
>>
>>If I need to execute the query in 2 different databases as follows:
>>
>>--1st connection
>>begin work;
>>insert into table1 value ('x');>>
>>--2nd connection
>>update table2 set column1 = columns2;>>commit work;
>>
>>I want both transaction to complete and then commit.
>>My question is whether I can issue just 1 BEGIN WORK/COMMIT WORK for both
>>connection and it will commit for both queries.
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/