Administration Guide
The simplest form of database usage is to read and write to
only one database within a single transaction (unit of work). This type
of database access is called remote unit of work.
Figure 45. Using a Single Database in a Transaction
Figure 45 shows an example of a database client running a funds
transfer application that accesses a database containing checking and savings
account tables, as well as a banking fee schedule. The application
performing the transfer includes the following steps:
- 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).
To set up this funds transfer application, you must:
- Create the tables for the savings account, checking account and banking
fee schedule in the same database (Chapter 4, Implementing Your Design)
- (If physically remote...) Set up the database server to use the
appropriate communications protocol, as described in the Quick
Beginnings manuals
- (If physically remote...) Catalog the node and database to identify
the database on the above database server, as described in the Quick Beginnings manuals
- Pre-compile your application program to specify a type 1 connection, that
is, specify CONNECT(1) on the PREP command, as described in the Application Development Guide manual.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]