2

I would like to know if you guys have any best practice when dealing with transaction between different databases vendors.

For example, if you have a C# application that save customer data in two databases (one Oracle and the other Microsoft), what would you do?

Would you use OleDbTransaction? Is it possible?

Junior Mayhé
  • 1,842
  • 2
  • 17
  • 35

2 Answers2

2

I believe that MSDTC is able to support transactions between different database instances. There are numerous resources about how to properly set up MSDTC and how to properly establish a transaction for your use case.

Another piece of advice I have when it comes to storing in different database instances altogether for the same application, you may run into situations where you may want to uniquely identify a particular record in one database over another, especially if there exists tables in both instances that have the same schema. You may want to consider uniquely identifying records by UID.

http://www.c-sharpcorner.com/UploadFile/prasoonk/FaqsAboutGUID06182009072827AM/FaqsAboutGUID.aspx

maple_shaft
  • 26,401
  • 11
  • 57
  • 131
1

As long as you can turn on MSDTC on all of the clients and servers that the transaction involves, MSDTC works like magic. It is about as simple as wrapping all of your calls in a transactionScope, and setting a condition for transactionScope.Complete() to be called. Definitely look into the security/performance issues this can cause in certain circumastances though. It is generally inadviseable to operate transactions over the internet, since it can increase the potential for attacks, but it works fine on an intranet.

Morgan Herlocker
  • 12,722
  • 8
  • 47
  • 78