Introduction
The JTA (Java Transaction API) allows applications to perform distributed transactions-accessing and updating data on two or more network computer resources. The JDBC driver's JTA support greatly enhances the data access capability.
The purpose of this article is to provide a high-level overview of the Java Transaction Processing API (JTA), as well as content related to distributed transactions. A transaction defines a unit of work logic that is either completely successful or produces no results. A distributed transaction is simply a transaction that accesses and updates data on two or more network resources, so it is necessarily equivalent between those resources. In this article, our main concern is how to deal with relational database systems.
The components that are included in the Distributed transaction Processing (DTP) model that we want to discuss are:
Application
Application Server
Transaction Management Program
Resource Adapters
Resource Management Programs
In future content, we will describe these components and their relationship to JTA and database access.
Accessing the database
It is a good idea to consider the components contained in distributed transactions as separate processes, rather than considering their location on a particular computer. Some of these components can be stored on a stand-alone machine, or they can be distributed among several machines. The chart in the following example shows the components on a particular computer, but the relationship between these operations must be considered first.
The simplest example: an application for local database transaction processing
The simplest forms of relational database access include only applications, resource managers, and resource adapters. An application is simply an end user access point that sends requests to the database and gets the data from the database
The Resource management program we discuss is a relational database management system (RDBMS), such as Oracle or SQL Server. All of the actual database management is handled by this component.
A resource adapter is a communication pipeline component between external spaces, or a request translator, in this case, an application and a resource management program. In our discussion, this is a JDBC driver.
The following description is a description of the local transaction processing of the resource manager, that is, a transaction is restricted to a specific enterprise database.
The application sends a request for the JDBC driver data, and then translates the request and sends it over the network to the database. The database sends the data back to the driver and then sends the translated results back to the application, as shown in the following illustration:
This example illustrates the basic flow of information in a simplified system; However, today's enterprise uses an application server that adds additional components to the process.