Progress
Programming
Handbook
Transactions in Multi-database Applications
In a multi-database application, you generally do not have to code any additional transaction handling. Multi-database transactions are handled in much the same way that single-database transactions are handled. The Progress two-phase commit mechanism ensures that any transaction is either committed to all affected databases or to none. You may, if you wish, check to see that all necessary databases are connected before you start a transaction.
Two-Phase Commit
During a transaction, Progress writes data to one or more databases as program control passes through database update statements in the transaction block. At the end of a transaction block, Progress tries to commit the changes to the databases. Progress uses a two-phase commit protocol to commit the changes to the databases. In the two-phase commit protocol, Progress polls all the databases affected by the transaction to see if they are reachable.
In the first phase of the two-phase commit, Progress checks whether it can reach each database and makes the appropriate validation checks for each database. If any one of the databases is unreachable or the validation checks fail for a database, Progress backs out the transaction and returns the databases to their pretransaction states using the before-image files. If all of the databases are reachable and their validation checks succeeded, Progress commits the changes to the databases.
For more information on two-phase commit, see the Progress Database Administration Guide and Reference.
Checking Database Connections
If you want to test database connections prior to entering a transaction, use the CONNECTED function.
You should connect to all databases affected by a transaction prior to entering a transaction block. As a general rule, do not execute a database connection in a transaction block. The database connection overhead could lock records in other databases affected by the transaction for considerable length of time. A database connection failure also causes a transaction error. Progress defers DISCONNECT statements in a transaction until the transaction completes or is undone.
For more information on connecting and disconnecting databases, see Database Access."
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |