Transaction Applications
iPlanetTM Application Server J2EE Samples

Updated  June 12, 2001

iPlanet Application Server supports two types of transactions:

  1. Local Transactions - managed within a single data source.
  2. 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:

  1. Transfer Amount is withdrawn from the Source Account in the Local Bank.
  2. Transfer Amount is deposited to the Recipient Account which is also in the Local Bank.
  3. 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: 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:

  1. Transfer Amount is withdrawn from the Source Account in the Local Bank data source.
  2. 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.
  3. 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: 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

Sample Application
Directory Name Description
Global Transaction from Servlet
transactions/global/web
Gets a javax.transaction.UserTransaction from java:comp/UserTransaction
Global Bean-Managed Transaction
transactions/global/bmt
Gets a javax.transaction.UserTransaction from an EJB Context.
Global Container-Managed Transaction
transactions/global/cmt
Lets the iPlanet Application Server implement the global transaction.


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.