Updating a single database in a transaction
The simplest form of transaction is to read from and write to only one database within a single unit of work. This type of database access is called a remote unit of work.
About this task

- Accept the amount to transfer from the user interface
- Subtract the amount from the savings account, and determine the new balance
- Read the fee schedule to determine the transaction fee for a savings account with the given balance
- Subtract the transaction fee from the savings account
- Add the amount of the transfer to the checking account
- Commit the transaction (unit of work).
Procedure
To set up such an application, you must do the following as part of the preparation to carry out the transaction within the environment:
- Create the tables for the savings account, checking account and banking fee schedule in the same database
- If physically remote, set up the database server to use the appropriate communications protocol
- If physically remote, catalog the node and the database to identify the database on the database server
- For applications using embedded SQL, precompile your application program to specify a type 1 connection; that is, specify CONNECT 1 (the default) on the PRECOMPILE command.