Connection of an J2EE application to databases is done through JDBC Resource Adapters (JDBC RA).
Such Resource Adapters are deployed via the resource service as seen in Section 2.4.16, “resource service configuration”.
For both container-managed or bean-managed persistence, the JDBC Resource Adapter makes use of relational storage systems through the JDBC interface.
JDBC connections are obtained from a JDBC RA.
The JDBC RA implements the J2EE Connector Specification using the DataSource interface as defined in the JDBC standard extensions.
An JDBC RA is configured to identify a database and a means to access
it via a JDBC driver. Multiple JDBC RAs can be deployed either via the
jonas.properties
file or included in the autoload
directory of the resource service.
The following section explains how JDBC RARs can be defined and configured in the JOnAS server.
To support distributed transactions, the JDBC RA requires the use of at least a JDBC2-XA-compliant driver. Such drivers implementing the XADataSource interface are not always available for all relational databases. The JDBC RA provides a generic driver-wrapper that emulates the XADataSource interface on a regular JDBC driver. It is important to note that this driver-wrapper does not ensure a real two-phase commit for distributed database transactions.
The generic JDBC RAs of JOnAS provide implementations of the
java.sql.Driver
,
javax.sql.DataSource
,
javax.sql.
ConnectionPoolDataSource
,
and javax.sql.XADataSource
interfaces. They are
located in the $JONAS_ROOT/rars/autoload
directory and thus
are deployed automatically.They consist of base (or generic) RAs
facilitating the build of the user JDBC RAs.
Depending on the relational database management server and the available interface in the used JDBC-compliant driver, the user JDBC RA is linked (through the RAR link feature) to a generic RA (for example, the Driver's one). In this case, the user RA contains only a jonas-ra.xml file with some specific parameters, such as the connection url, the user/password, or the JDBC-Driver class.
Resource adapter provided with JOnAS | description | jndi name |
rars/autoload/JOnAS_jdbcDS.rar | Generic JDBC RA that implements the
DataSource interface |
JOnASJDBC_DS |
rars/autoload/JOnAS_jdbcDM.rar | Generic JDBC RA that implements the
Driver interface |
JOnASJDBC_DM |
rars/autoload/JOnAS_jdbcCP.rar | Generic JDBC RA that implements the
ConnectionPoolDataSource
interface |
JOnASJDBC_CP |
rars/autoload/JOnAS_jdbcXA.rar | Generic resource adapter that implements the
XADataSource interface |
JOnASJDBC_XA |