Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where I'm Wrong? (MTS component problem) 1

Status
Not open for further replies.

sorin

Programmer
Sep 20, 2001
6
US
Hi,
I'm new to transactions, so if the question is very simple for you, still please reply.

I'm triing to build a transaction that use 3 components
This transaction should read a message from a queue (MSMQ) do some processing with that message and write back to the queue another message.
The first component is RootTransaction (set to Require a new transaction) This one just instantiate the other 2 and call them. It instantiate them using objCtx.CreateInstance to preserve the context of the transaction.
The second component(OperateQueue)(set to require transaction)read and write to the queue-This work fine.
The third component (ExecuteTasks)(set to require transaction) should do some database processing with the message received from the queue.Here I have problems:
Any time I'm trying to write to database I receive an error like "Distributed transaction completed, Either enlist this transaction into anew one or into the NULL transaction"
I must mention that i create the connection obj with objCtx.CreateInstance("ADODB.Connection")
-is this correct?
-Do you have any working example that do any update to a table into a component used into a transaction?

Practiclly, I don't want to finish the transaction into OperateQueue or ExecuteTask objects.


also at the end of the OperateQueue component I call objCtx.EnableCommit or objCtx.DisableCommit

I use NT4 workstation, sql 7

Thank you,

Sorin

 
If the second component called by the root object is doing some Definitional(DDL) query then u will loose the conext of the transaction. Just go thro the second component's processing(even if this calls say a stored procedure which might do some DDL command executions).

Further use the "EnableCommit" instead of "setcomplete" in the first and second component called by the root(root should always call setcomplete/setabort).May be this might help.
 
Thank you for your reply.
I found the problem. The second component (which interact with a third party application take a long time to complete (3-10 min) and the transaction timeout and it's rolled back.
I changed the timeout limit and now it's working.

sorin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top