none
Dual Phase Transaction commit RRS feed

  • Question

  • Hi,

     

     Is there a way to use something similar to System.Transaction's(.Net 2.0) two phase commit in .Net 1.1 using c#??

     

    I have dual transaction updates on two different data sources.

     

    Regards

    Kevin

     

    Thursday, May 10, 2007 12:42 PM

Answers

  • Hi Kevin,

    Yes, .NET Framework 1.x relies on System.EntepriseServices. System.EnterpriseServices is the API wrapping Microsoft Transaction Server which uses the Distributed Transaction Coordinator to enable two phase commits across databases and msmq's. Here's a nice article which introduces the main concepts, strategy to follow and comes with code.
    Thursday, May 10, 2007 4:04 PM
  • You can do something very similar using Services without Components (SwC)- which is a feature of COM+ 1.5 i.e XP and Win2003
    see the following article for example :http://www.15seconds.com/issue/030930.htm

    Note that using SwC you can't do some of the more funky stuff you can do with System.Transactions like having multiple working threads participate in the same distributed transaction , using the Lightweight Transaction Manager to do  in-memory pseudo transactions or stuff like that. Nevertheless for straightforward stuff you can get pretty much the same behavior you do with System.Transactions

    Arnon
    Thursday, May 10, 2007 8:04 PM
  • What both Paul and me are saying is that you have to use COM+ and DTC to do distributed transactions (in Windows).
    in .NET 1.1 that translates to either using Enterprise Services or Services without Components

    choose your poison Smile

    Arnon
    • Marked as answer by Logicboy Monday, November 23, 2009 11:17 AM
    Friday, May 11, 2007 7:57 PM

All replies

  • Hi Kevin,

    Yes, .NET Framework 1.x relies on System.EntepriseServices. System.EnterpriseServices is the API wrapping Microsoft Transaction Server which uses the Distributed Transaction Coordinator to enable two phase commits across databases and msmq's. Here's a nice article which introduces the main concepts, strategy to follow and comes with code.
    Thursday, May 10, 2007 4:04 PM
  • You can do something very similar using Services without Components (SwC)- which is a feature of COM+ 1.5 i.e XP and Win2003
    see the following article for example :http://www.15seconds.com/issue/030930.htm

    Note that using SwC you can't do some of the more funky stuff you can do with System.Transactions like having multiple working threads participate in the same distributed transaction , using the Lightweight Transaction Manager to do  in-memory pseudo transactions or stuff like that. Nevertheless for straightforward stuff you can get pretty much the same behavior you do with System.Transactions

    Arnon
    Thursday, May 10, 2007 8:04 PM
  • Guys,
     Thanks for your reply but unfortunately i do know we use COM+ and it inturns does a dual phase commit thats a different story and relationship between COM+ and the DataStore(Oracle or SqlServer).
    Second reply was about using COM+ services without inherting from ServiceComponent base class .Well, i do know that its available only in windows 2003 Server.We use Config and Domain.I have already tried that.
     Let me explain you what im looking for .I have two actions(Methods) A and B.A updates SqlServer and B updates Oracle.
    Kind of Asychronous in nature.
    If A fails B shouldnt succeed as well and should rollback and Vice versa.Similar to what COM+ does with DTC towards data sources.
    Now this can be achieved using C# with 2 methods using System.Transaction but only in .Net 2.0.

    My interest is how to accomplish this in .Net 1.1

    Regards
    kevin
    Friday, May 11, 2007 12:58 PM
  • > If A fails B shouldnt succeed as well and should rollback and Vice versa.
    > Similar to what COM+ does with DTC towards data sources.

    System.Enterprise services uses COM+/MTS/DTC under the hood and runs on win2k. This is exactly (and the only way in .NET 1.x) what you need to update both a SQL Server database and an Oracle database from a .NET component.
    Friday, May 11, 2007 7:15 PM
  • Kevin,
    Maybe I don't understand you but that's exactly what you can do in .NET 1.1 using Services without components
    You create a context which is very similar to what you have in Systems.Transactions
    and as long as the two methods are called on the same thread you get a DTC distributed transaction.
    By the way, behind the curtains System.Transactions also uses the DTC in situations like you describe.
    Friday, May 11, 2007 7:50 PM
  • What both Paul and me are saying is that you have to use COM+ and DTC to do distributed transactions (in Windows).
    in .NET 1.1 that translates to either using Enterprise Services or Services without Components

    choose your poison Smile

    Arnon
    • Marked as answer by Logicboy Monday, November 23, 2009 11:17 AM
    Friday, May 11, 2007 7:57 PM