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


MTS Transaction Control

MTS Transaction Control

MTS Transaction Control

I am familiar with MTS declaritive transactions.  However, I am having a problem with the following...

I have an application that is comprised of the following operations that make up a transaction.

Select Reference Number
Insert Records Based Upon Selected Reference Number
Update Reference Number

I have 3 methods that carry out each action and a wrapper method to call each of these according to our business logic.  MTS is sumbitting or rolling back as 1 transaction, BUT I can not adequately lock the table that is storing the reference number for the duration of a transaction.  That is if multiple clients initiate this transaction all clients read the same reference number ... I don't want clients to select the reference number until previous transactions have been completed or aborted.  From what I can find, read locks do not exclude other read locks.  Any suggestions?

RE: MTS Transaction Control

I did something similar on my last project. What worked for me was tweaking the SQL / stored procedure that reads the reference number (step 1 above) so that it actually does a dummy update as well as the read, e.g. UPDATE RefNumbers SET NextRefNum = NextRefNum. In the same procedure, do the select that actually selects the reference number as before. This way, the reference number table / row gets a lock for the duration of the transaction (even though you haven't actually changed its value yet until step 3).

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