Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling Database Transactions : Database transactions in applications : Multi-database applications : Two-phase commit
 
Two-phase commit
During a database transaction, WebSpeed 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, WebSpeed tries to commit the changes to the databases. WebSpeed uses a two-phase commit protocol to commit the changes to the databases. In the two-phase commit protocol, WebSpeed polls all the databases affected by the transaction to see if they are reachable.
In the first phase of the two-phase commit, WebSpeed 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, WebSpeed 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, WebSpeed commits the changes to the databases.
For more information on two-phase commit, see OpenEdge Data Management: Database Administration.