Transaction Processing

You are familiar with individual data source operations that insert, update, or delete data source segment instances. However, most applications are concerned with transactions, such as transferring funds or fulfilling a sales order, that each require several data source operations. These data source operations may access several data sources, and may be issued from several procedures. Such a collection of data source operations is called a logical transaction (and is also known as a logical unit of work.)

The advantage of describing a group of related data source commands as one logical transaction is that the transaction is written to the data source only if all of its component commands are successfully written to the data source. Transaction integrity is an uncompromising proposition: if even one part of the transaction fails when you try to write it (by issuing the COMMIT command), Maintain automatically rolls back the entire transaction, leaving the data source unchanged.

Transaction integrity also ensures that when several users share access to the same data source, concurrent transactions run as if they were isolated from each other. The changes caused by a transaction in a data source are concealed from all other transactions until that transaction is committed. This prevents each transaction from being exposed to interim inconsistent images of the data source, and so protects the data from corruption.

There are many strategies for managing concurrent data source access. No matter which type of data source you use, Maintain respects the DBMS concurrency strategy and lets it coordinate access to its own data sources.

Transaction processing is described in greater detail in Ensuring Transaction Integrity in the Developing WebFOCUS Maintain Applications manual.

Top of page

Example: Logical Transactions in a Bank

A banking application would define a transfer of funds from a checking account to a savings account as one logical transaction comprising two update operations:

If the application had not been able to subtract the funds from the checking account, because someone had cleared a check against that account a few moments earlier and depleted its funds, but the application had added the funds to the savings account, the bank accounts would become unbalanced.

The two update commands (subtracting and adding funds) must be described as parts of a single logical transaction, so that the subtraction and addition updates are not written to the data source independently of each other.