[DB-SIG] Need help regarding XA Compliant 2PC protocol
james at jamesh.id.au
Fri Jan 18 12:36:44 CET 2008
On 18/01/2008, Nand Rathi <nand_rathi at yahoo.com> wrote:
> Hello All
> I see a current thread regarding 2PC protocol, but my
> requirement is little different.
> I need to write some python programs which will access
> 2 databases simultaneously (Oracle & Postgresql). I
> need to use 2PC to maintain the transaction integrity.
If you are only accessing two databases, you only need 2PC support on
one of them. The protocol would be something like this:
1. Prepare the transaction for 2PC on the first connection.
2. If the transaction could not be prepared, rollback both connection.
3. If the transaction could be prepared, commit the second connection.
4. If the second connection committed successfully, complete the
transaction on the first connection
5. If the second connection failed to commit, rollback the prepared
transaction on the second connection.
The patch I did for psycopg2 should let you perform 2PC, so could be
used as above whether or not the Oracle adapter you are using supports
More information about the DB-SIG