Assembling data access applications
When you assemble enterprise bean code into files that can be deployed onto an appserver, you configure properties that define how the application accesses an enterprise information system (EIS), such as a database.
This topic assumes that you have created an enterprise application containing an EJB module that must transact with a database.
Overview
A data access application uses resources, such as data sources or connection factories, to connect with a database.
An application component uses a connection factory to access a connection instance, which the component then uses to connect to the underlying enterprise information system (EIS). Examples of connections include database connections, JMS connections, and SAP R/3 connections.
During application assembly you perform activities that enable the application to use these resources. The process typically requires an assembly tool.
Procedure
- Identify the logical names that are used by the EJB module to reference application resources. These logical names are called resource references. For further explanation, consult the The benefits of using resource references topic.
- Start an assembly tool.
- If you have not done so already, configure the assembly tool for work on J2EE modules. Ensure that J2EE capability is enabled.
- Define mapping and security properties for the resource references. This process includes the following activities:
- Bind the resource references to the application resources that provide database connectivity. See the Data source lookups for enterprise beans and Web modules topic for more information on the concept of binding. At deployment time you can alter your bindings if necessary.
- For each resource define an authentication type, which is the security configuration through which database connections are granted. There are two authentication types:
Consult the J2EE connector security topic for detailed reference on resource authentication.
- Component-managed
- The enterprise bean code performs EIS signon for data source or connection factory connections.
- Container-managed
- WAS performs EIS signon.
- Configure access intent assembly settings for your enterprise beans.
- Right-click your EJB module in a Project Explorer view and click Open With > Deployment Descriptor Editor.
- In an EJB Deployment Descriptor editor, select the Access tab.
- Under Isolation Level, click Add.
- Select the isolation level, enterprise beans, and method elements. For information on isolation levels, press F1.
- Click Finish.
- Map enterprise beans to database tables.
Results
Files for the updated application are shown in the Project Explorer view.
What to do next
After testing your application, you are ready to deploy your application to an appserver.
Creating or changing a resource reference
Assembling resource adapter (connector) modules
Migrating applications to use data sources of the current JCA
Related concepts
JDBC providers
Data sources
Related Reference
Data access: Resources for learning
Related information
Start the Application Server Toolkit assembly tool
Configure the Application Server Toolkit assembly tool