Transaction Applications
iPlanetTM
Application Server J2EE Samples
Updated June 12, 2001
iPlanet Application Server supports two types of transactions:
- Local Transactions - managed within a
single data source.
- Global Transactions - span multiple data
sources.
The Transaction samples showcase different ways of implementing local and global
transactions using the iPlanet Application Server.
Local Transaction
A local transaction is native to a database and it is restricted to a single process.
Local transactions work within a single data source only. They are typically
demarcated using JDBC APIs.
Local Transaction Scenario
There is only one scenario for the local transaction sample applications in this
package. The application enables a user to transfer funds from one bank account
to another, within the same bank.
Diagram 1 - Local Transaction Scenario
The local transaction sample involves the following steps:
- Transfer Amount is withdrawn from the Source Account in the Local Bank.
-
Transfer Amount is deposited to the Recipient Account which is also in
the Local Bank.
- If the resulting balance for the Source Account is not negative, the transaction
is committed. Otherwise the Source Account does not have enough funds to transfer
and the transaction is rolled back. In the case of a rollback, both the Source
and Recipient Accounts retain their original balances.
Local Transaction
Resource Requirements
The local transaction sample applications in this package require the following
resources:
- iPlanet Type 2 or Third-Party Type 4 database driver. The PointBase driver
is not supported for this sample.
-
Database Server for a Local Bank database
-
Local Bank database
-
Database User localbank
These resources need to be set up once and can be used for all of the local
transaction sample applications in this package.
Local Transaction Sample
Applications
Sample Application
|
Directory Name
|
Description
|
Local JDBC Transaction
|
transactions/local/jdbc
|
Uses JDBC's java.sql.Connection class to implement a local transaction.
|
Global Transaction
A global transaction is coordinated by a transaction manager. It can span multiple
data sources and processes.
Global Transaction Scenario
There is only one scenario for the global transaction sample applications in this
package. The application allows the user to transfer funds from a local bank account
to a foreign bank account (or vice versa), across different banks.
Diagram 2 - Global Transaction Scenario
The global transaction involves the following steps:
- Transfer Amount is withdrawn from the Source Account in the Local Bank data
source.
- Transfer Amount is deposited to the Recipient Account in the Foreign Bank
data source. The Local Bank and Foreign Bank data sources are distinct data
sources and could reside in different database servers. For example, the Local
Bank data source could be an Oracle server while the Foreign Bank data source
could be a Sybase server.
- If the resulting balance for the Source Account is not negative, the transaction
is committed. Otherwise the Source Account does not have enough funds to transfer
and the transaction is rolled back. When a rollback occurs both the Source
and Recipient Accounts retain their original balances.
Global Transaction
Resource Requirements
The global transaction sample applications in this package need the following
resources:
- iPlanet Type 2 database driver (Third party Type 4 drivers are not supported).
-
Database Server for a Local Bank database
-
Local Bank database
-
Database User localbank
-
Resource Manager for the Local Bank Database Server
-
Database Server for a Foreign Bank database
-
Foreign Bank database
-
Database User foreignbank
-
Resource Manager for the Foreign Bank Database Server
These resources need to be set up once and can be used for all of the global
transaction sample applications in this package.
Global Transaction Sample
Applications
Further Exploration
Consult the iPlanet Application Server's Administrator's Guide and Developer's
Guide manuals for more information on managing transactions within iPlanet Application
Server.
Copyright
(c) 2001 Sun Microsystems, Inc. All rights reserved.