M.-A. Lemburg wrote:
> Stuart Bishop wrote:
>> Hi.
>>
>> Are there any drivers out there that support two phase commit.
>>
>> If so, what syntax do they use?
> 
> I'm not aware of any native driver that does support this, except a
> patched DCOracle2:
> 
> http://pymqi.sourceforge.net/
> 
> You can also use mxODBC with an XA enabled ODBC driver (I think
> the EasySoft Oracle ODBC driver is capable of doing XA), but the
> APIs for setting this up are different for each driver.
> 
>> Is it worth adding a standard API for this as an optional extension to the
>> DB-API 2.0? Enough backends now support this that I suspect it is worth
>> doing this now to avoid unnecessary incompatibilities between backend
>> specific database APIs.
> 
> I'm not sure I can follow you here: if you do two-phase commit
> under the control of a transaction manager such as MQSeries
> or MS DTS, then the transaction manager will take care of
> the transaction, not the database interface (see e.g. the DCOracle2
> XA example in http://pymqi.sourceforge.net/).

My objective is to add the functionality to psycopg now that PostgreSQL
supports two phase commit. I'm not interested in using a third party
transaction manager - just something like the following (using KInterbaseDB
prepare() method - thanks David):

>>> con1 = connect('dbname=db1')
>>> con2 = connect('dbnane=db2')
[ Make changes to both databases ]
>>> # These prepares may raise exceptions if database limits are
>>> # reached or serialization exceptions raised from running in
>>> # serializable transaction isolation level.
>>> con1.prepare()
>>> con2.prepare()
>>> # These commits guaranteed to succeed except in extraordinary
>>> # circumstances.
>>> con1.commit()
>>> con2.commit()

This can also be used to correctly hook the database adapters into Zope or
other transactional systems that support two phase commit to avoid the rare
but possible data corruption that can occur when dealing with multiple
databases.

-- 
Stuart Bishop <[EMAIL PROTECTED]>
http://www.stuartbishop.net/

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to