×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Where I'm Wrong? (MTS component problem)

Where I'm Wrong? (MTS component problem)

Where I'm Wrong? (MTS component problem)

(OP)
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

RE: Where I'm Wrong? (MTS component problem)

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.

RE: Where I'm Wrong? (MTS component problem)

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close