|
he purpose of this article is to provide a high-level overview of the Java
Transaction API (JTA), and how it is related to
distributed transactions. A transaction
defines a logical unit of work that either completely succeeds or produces
no result at all. A distributed transaction is simply a transaction that
accesses and updates data on two or more networked resources, and therefore
must be coordinated among those resources. In this paper, we are concerned
primarily with transactions that involve relational database systems.
The components involved in the distributed transaction processing
(DTP) model that are relevant to our discussion are:
- The application
- The application server
- The transaction manager
- The resource adapter
- The resource manager
In the following sections, we describe these components and their
relationship to JTA and database access.
Accessing Databases
It is best to think of the components involved in distributed transactions
as independent processes, rather than thinking of them in terms of
location on a particular computer. Several of the components may reside on
one machine, or they may be spread among several machines. The diagrams in
the following examples may show a component on a particular computer, but
the relationship among the processes is the primary consideration.
The Simplest Case: Application to Database Local Transactions
The simplest form of relational database access involves only the
application, a resource manager, and a resource adapter. The application is
simply the end-user access point to send requests to, and obtain data from,
a database.
The resource manager in our discussion is a relational database
management system (RDBMS), such as Oracle or SQL Server. All of the actual
database management is handled by this component.
The resource adapter is the component that is the communications channel,
or request translator, between the "outside world," in this case the
application, and the resource manager. For our discussion, this is a JDBC
driver.
The following description is of a resource manager local
transaction, that is, one transaction that is confined to a single,
specific enterprise database.
The application sends a request for data to the JDBC driver, which then
translates the request and sends it across the network to the database. The
database returns the data to the driver, which then translates the result to
the application, as illustrated in the following diagram:
This example illustrates the basic flow of information in a simplified
system; however, the enterprise of today uses application servers, which
adds another component to the process.
Application Servers
The application server is another component of the transaction process that
is addressed by the JTA. Application servers handle the bulk of application
operations and take some of the load off of the end-user application.
Building on the preceding example, we see that the application server adds
another process tier to the transaction:
Up to this point, our examples illustrate a single, local transaction and
describe four out of the five components of the distributed transaction
model. The fifth component, the transaction manager, comes into
consideration only when transactions are to be distributed.
| Copyright © 2002 DataDirect, Inc. Reprinted with permission.
|
|