Data Sources
Overview
The JCA connection factories used by relational resource adapters to obtain data from relational databases is constructed by associating JDBC providers with data sources.
A ConnectionPoolDataSource supports application participation in all transactions, including two-phase commit transactions. When this kind of data source is involved in a global transaction, transaction recovery is not provided by the transaction manager. The application is responsible for providing the backup recovery process if multiple resource managers are involved.
An XADataSource supports application participation in a single-phase or a global (two-phase) transaction environment. When this data source is involved in a global transaction, the transaction manager provides transaction recovery.
Binding to a data source
Resource references are bound to the actual name of the resource during either application assembly or application deployment.
Container-managed persistence bean
With CMP beans the code does not specifiy a datasource, rather, the data source is specified during assembly in the Bean Binding panel.
Bean-managed persistence bean
For BMP beans, in the code, do not look up the data source directly. Rather, look up the resource reference from the java:comp/env namespace file. For example, assume that you look up a resource reference named ref/ds:
javax.sql.DataSource xDS = (javax.sql.DataSource) ( (new InitialContext()).javax.naming.Name)">lookup("java:/comp/env/ref/ds") ) ( javax.sql.DataSource ) javax.rmi.PortableRemoteObject.narrow ( (new InitialContext()).javax.naming.Name)">lookup("jdbc/Section"), javax.sql.DataSource.class );In the ATK, you specify the name ref/ds in the Resource Reference page on the General Tab. If you know the name of the data source you can specify it in this Resource References page on the Bindings Tab. Note that if you do not specify it here , provide this JNDI name when you install the application EAR file.
Servlets and JSP files look up the DataSource using the same methods as the BMP bean case.
Access intent and isolation level
The access intent service allows one to tune application persistence using the isolation level
Access intent enables developers to configure applications so that the EJB container and its agents can make performance optimizations for entity bean access.
A policy is acted upon by either the combination of the WebSphere EJB container and Persistence Manager, for container-managed persistence entities, or by bean-managed persistence entities directly.