Create a transactional script (manage transactions, components with MTS)

Source: Internet
Author: User
Tags terminates
Commercial applications often need to have the ability to run scripts and components within a transaction. A transaction is a server operation that, even if it involves many steps (for example, ordering, viewing inventory, paying bills, and so on), can only return the success or failure of the operation as a whole. A user can create an ASP script that runs inside a transaction, and the entire transaction terminates if any part of the script fails.
ASP transaction processing is based on Microsoft Transaction Server (MTS). Microsoft Transaction Server (MTS) is a transaction processing system for developing, configuring, and managing High-performance, scalable, and robust enterprise Internet and Intranet server applications. Transaction Server provides an application design model for developing distributed, component-based applications. It also provides a running environment for configuring and managing these applications.
The ability to create transactional scripts is built into the Internet Information Server and Personal Web server. If you have installed Microsoft Transaction Server, you can package the components so that the components run within the transaction.
About transactions
A transaction is an overall success or failure operation. Transaction processing is used to reliably update the database. Make sure that all changes are performed correctly when you make many related changes to the database or when you update multiple databases simultaneously. If any of these changes fail, you need to restore the original state of the database table.
Without MTS, you would need to write scripts and components to manually track changes to the request to recover the data if some of the changes fail. With MTS, you simply declare your scripts and components as "need transactions" and let MTS process the consistency of transactions. Transactions apply only to database access, and MTS cannot recover from changes to file systems or other non-transactional resources. The database accessed by the application must be supported by MTS. Currently, MTS supports SQL Server and any servers that support the XA protocol (developed by the X/open Association). MTS will continue to expand its support for other databases.
Transactions cannot span multiple ASP pages. If a transaction requires objects from more than one component, you must combine the operations that use these objects into an ASP page. For example, suppose a component is used to update payroll databases, and a component is used to update employee records in the human resources database. To record the new payroll information for an employee, you need to write a script that calls both components in a transactional environment, one for updating payroll databases, and another for updating employee levels in the human resources database.
Declaring a transactional script
When you declare a page as transactional, any script commands and objects in this page run in the same transaction environment. The Transaction Server processes the details of the generated transaction and determines whether the transaction succeeds (commits) or fails (terminates). To declare a page as transactional, you can add a @TRANSACTION directive at the top of the page:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.