Transaction Processing [Abstract]

Source: Internet
Author: User
Transaction Processing

A transaction is a database operation that combines logical units in a group. errors may occur during system execution, but Transactions Control and maintain the consistency and integrity of each database. The main feature of transaction processing is that tasks are either completely completed or not completed. When writing some records, either write all the records or write nothing. If a failure occurs when writing a record, other data already written in the transaction will be rolled back. A transaction may consist of many individual tasks.

A common example of A simple transaction: transferring money from account A to account B involves two tasks: getting the money from account A and saving the money to account B. The two tasks either succeed at the same time or fail at the same time, and are rolled back to keep the account in the same status as before. Otherwise, an operation may fail due to power failure or network interruption. Therefore, the rows in a table may be updated, but the rows in the table may not be updated. If the database supports transactions, you can combine database operations into a transaction to prevent database inconsistencies due to these events.

The ACID attribute of the transaction is as follows.

L Atomicity: all operations of a transaction are atomic units of work. Modifications to the data of a transaction are either executed or not executed. Atomicity eliminates the possibility of a subset of system processing operations.

L Consistency: data is converted from one correct state to another. When the transaction is completed, all data must be consistent. In related databases, all rules must be applied to transaction modifications to maintain the integrity of all data. When the transaction ends, all internal data structures must be correct. In the example of deposit withdrawal, the logical rule is that money cannot be generated or destroyed out of thin air, and each (Revenue and Expenditure) entry must have a corresponding offset entry, to ensure that the account is flat.

L isolation: the modifications made by the concurrent transactions must be isolated from those made by any other concurrent transactions. View the status of the data in the data hour, either the status before the transaction modifies it, or the status after the transaction modifies it. A simple understanding is to prevent multiple concurrent updates from interfering with each other. Transactions are isolated from other transaction operations when operating data. Isolation is generally achieved through the locking mechanism.

L durability: after a transaction is completed, its impact on the system is permanent. The submitted changes still exist in the event of a fault.

For transaction development, the. NET platform also provides several simple and convenient transaction mechanisms. Both in terms of functionality and performance provide excellent enterprise-level transaction support.

. NET developers can use the following five transaction mechanisms:

L SQL and stored procedure-level transactions.

L ADO. Net-level transactions.

L asp. NET page-level transactions.

L enterprise-level service COM + transactions.

L system. Transactions transaction processing.

These five transaction mechanisms have their own advantages and disadvantages, including performance, code quantity, and deployment settings. Developers can select the corresponding transaction mechanism based on the actual situation of the project.

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.