Twophase Support for MSSQL

Issue #822 resolved
Former user created an issue

I'm using both a MySQL and a MSSQL server for an application, so I added the following code to the MSSQLDialect to get twophase support.

Additionally, I changed the default dialect's create_xid method, which returns a transaction ID, to reference and truncate to max_identifier_length (it was failing due to this with pymssql) and to not use any underscores in the name (which, I believe, fails with MSSQL in general).

Both patches attached, against current trunk (r3643). They work with an application I have running using pymssql, but are untested with pyobdc or adodbapi as I don't have environments for them.

Comments (15)

  1. Mike Bayer repo owner
    • assigned issue to
    • changed milestone to 0.4.xx

    i can patch these but it would be nice to see if someone can test on a few environments...

  2. Former user Account Deleted

    mssql.diff makes the following changes:

    • savepoint support

    • real two phase support using the jdbc XA stored procs (see MSSQLTwoPhaseCommit)

    • turns implicit transactions off and manually begins normal transactions.

    Laurence (l@lrowe.co.uk)

  3. Former user Account Deleted

    Two phase support requires sending a specific TDS packet (see MSSQLTwoPhaseCommit) in order to enlist a connection in the DTC transaction, so this part is on hold until I can work out how (and if) I can manage this.

    The savepoint support is however working and tests pass (with pyodbc and mssql 2005).

    Laurence (l@lrowe.co.uk)

  4. Former user Account Deleted

    Yes, I think I need to add methods to the pyodbc driver before two phase commit can work.

    Laurence

  5. Mike Bayer repo owner

    pushing this to 0.6 for the dialect refactor, but 0.5.xx code will be accepted as well.

  6. Mike Bayer repo owner

    For now I've just turned on the already present savepoint functionality, that's in 58e692d76bbea84667609a4ceb828dcf43571f6e.

    As far as two-phase, I've reviewed the notes on the above mentioned wiki page and it appears 2-phase is tremendously complex and not really implemented. This ticket can of course be reopened if there's interest/progress on getting 2-phase to work but I don't see this happening now.

  7. Log in to comment