SQL Server and MTS


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: SQL Server and MTS

  1. #1
    Erik Cruz Guest

    SQL Server and MTS

    Hi.

    Maybe I have a basic question here.

    If I have an MTS component that executes an stored procedure under SQL
    Server, and I don't handle any errors in this stored procedure, if an error
    occurs inside the stored procedure, does MTS abort my transaction?

    Thanks.


    Share on Google+

  2. #2
    Paul Clement Guest

    Re: SQL Server and MTS

    On Fri, 26 Oct 2001 00:10:03 -0200, "Erik Cruz" <erikacf@antares.com.br> wrote:

    Hi.

    Maybe I have a basic question here.

    If I have an MTS component that executes an stored procedure under SQL
    Server, and I don't handle any errors in this stored procedure, if an error
    occurs inside the stored procedure, does MTS abort my transaction?

    If the code you use (ADO I'm assuming) fails (generates a runtime error) you should call the
    SetAbort method of the transaction context object you've instantiated in your code. SetAbort will
    release the transaction in an *unhappy* state which will cause any successful pending updates to be
    rolled back.


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)
    Share on Google+

  3. #3
    Erik Cruz Guest

    Re: SQL Server and MTS

    Hi Paul,

    yes, that's the correct way. But what if I don't call SetAbort after an
    error occurs. Will MTS abort my transaction, since the code was interrupted
    by an error?

    Thanks.


    Share on Google+

  4. #4
    Paul Clement Guest

    Re: SQL Server and MTS

    On Sat, 27 Oct 2001 00:15:53 -0200, "Erik Cruz" <erikacf@antares.com.br> wrote:

    Hi Paul,

    yes, that's the correct way. But what if I don't call SetAbort after an
    error occurs. Will MTS abort my transaction, since the code was interrupted
    by an error?

    Unless there is some type of fatal system error the answer is no. If you don't call SetAbort and
    there are successful updates that occurred within the transaction context, they will be committed.

    Unless you are working with components that maintain state across method calls, you should always
    call either SetComplete or SetAbort to explicitly set the transaction flag and release the instance
    of the component.


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)
    Share on Google+

  5. #5
    Narayana Pakala Guest

    Re: SQL Server and MTS


    "Erik Cruz" <erikacf@antares.com.br> wrote:
    >Hi.
    >
    >Maybe I have a basic question here.
    >
    >If I have an MTS component that executes an stored procedure under SQL
    >Server, and I don't handle any errors in this stored procedure, if an error
    >occurs inside the stored procedure, does MTS abort my transaction?
    >
    >Thanks.
    >
    >


    Hi
    Yes, it does.
    Have a look at this MSDNMag article:
    http://msdn.microsoft.com/msdnmag/is...basics0600.asp

    Regards
    Narayana

    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center