Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling Database Transactions : What is a database transaction?

What is a database transaction?

A database transaction (DB transaction) is a unit of work that is either completed as a unit or undone as a unit. Proper database transaction processing is critical to maintaining the integrity of your databases.
Suppose you are entering new customer records into your database and are entering the 99th customer record. If your machine goes down, are the first 98 records you entered lost? No, because WebSpeed:
*Keeps the first 98 records in the database
*Discards the partial 99th record
This is just one simple scenario. Suppose the procedure was updating multiple tables. You want to make sure that WebSpeed saves any completed changes and discards partial changes in all tables.
System failures are just one kind of error. There are other kinds of errors that can occur while a procedure is running. Regardless of the kind of error you are dealing with, data integrity is all important. Data integrity means that WebSpeed only stores completed data in the database. WebSpeed uses database transactions to automatically handle this processing.
For any WebSpeed application that updates a database, you must consider at what point you want a database transaction to begin and how many page requests you need it to last. In other words, how much of a database update do you want to roll back at one time in the event of an error, exception, or incorrect data input.
* DB transactions in code
* All-or-nothing processing