Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 825
  • Last Modified:

Transactions without MSDTC

I am looking for a solutions to the following problem:

I need to be able to handle transactions across multiple sql servers without invoking MSDTC.  I know there has to be a way to do this by enlisting in a transaction that i implement myself, i'm just not finding any information on how to do it without using MSDTC.  

I know that the "autoEnlist=false" will keep the transactionscope object from starting DTC, but i can't find examples managing transactions without msdtc.

Please help!!
0
kmitch62
Asked:
kmitch62
  • 2
  • 2
1 Solution
 
grayeCommented:
That's a bit odd... since Microsoft wrote the Distrubuted Transaction Coordinator service specifically for this scenario
What's your beef with MSDTC?
0
 
kmitch62Author Commented:
Personally, I don't have any beef with it.  The organization i'm working for feels that there are performance issues that they can't have in their OLTP application.

I'm aware that MSDTC is basically the standard, but I have to live within my constraints.
0
 
grayeCommented:
Ok... I'm assuming we are talking about a database transaction?  If so tell more about the databases (SQL Server 2008?)
0
 
kmitch62Author Commented:
I've worked out the answer.

1. use the transactionscope object with the "autoenlist=false" in the connectionstrings of the connections.  if you don't use autoenlist=false, transactionscope automatically tries to enlist in MSDTC.
2. create an object that inherits DbTranaction and IEnlistmentNotification
3. When the connection is instanciated, you have to manually create the object in #2 and then enlist in the abient transaction with Transaction.Current and Transaction.EnlistVolitile method
4. write the object in #2 to override the iEnlistmentNotification methods.
5.when all transaction functionality is completed, call TransactionScope.Complete.  This will commit all the contained transactions.  If an error is thrown by any of the transaction functionaltiy, the transactionscope will rollback all contained transactions.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now