Process DB2 data commit and rollback statements and transaction boundaries

Source: Internet
Author: User
Tags savepoint

Work Unit and storage point

Unit of work (uow)Also knownTransactionsIt is an applicationProgramProcessRecoverable)Operation Sequence. A typical uow example is a simple bank transfer transaction, that is, transferring funds from one account to another. After an application deducts a certain amount of funds from one account, the database will be inconsistent. After the same amount of funds is added to the second account, this inconsistency will be eliminated. After these modifications are submitted, other applications can use them.

When the first SQL statement in the application process is sent to the database, a uow starts implicitly. All subsequent read/write operations of the same application are considered as part of the same uow. The application can issueCommitOrRollbackStatement to end uow.CommitThe statement persists all the modifications made in the uow.RollbackStatement. If the application ends normally without explicitCommitOrRollbackThe uow statement is automatically submitted. If the application is terminated unexpectedly before the uow ends, the unit is automatically rolled back.

Savepoint)Allows selective rollback to form a subset of uow operations, so that the entire transaction will not be lost. You can nest and save points and have several activeSavepoint level); This allows the application to roll back to a specific storage point as needed. Assume that three storage points (A, B, and C) are defined in a uow ):

Do some work; savepoint A; do some more work; savepoint B; do even more work; savepoint C; Wrap it up; roll back to savepoint B;

Rollback to save point B will automatically release save point C, but save points A and B are still active.

For more information about saving points and detailed examples of DB2 saving points, see references.

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.