Defining data sources for entity beans

Before an application that is installed on an application server can start, all enterprise bean (EJB) references and resource references defined in the application must be bound to the actual artifacts, enterprise beans or resources, defined in the application server.

Before you begin

Create a data source or JDBC resource and give it a Java Naming and Directory Interface (JNDI) name.

About this task

For more information, see Application bindings.

The following steps assume that the entity beans in your application are container-managed persistence (CMP) enterprise beans. The EJB container handles the persistence of the bean attributes in the underlying persistent store. You must specify which data store is used. You do this by binding an EJB module or individual EJB to a data source.

If you bind an EJB module to a data source, all beans in that module use the same data source for persistence. If you specify the data source at the bean level, then that data source is used instead.

Procedure

  1. Start the Application Server Toolkit.
  2. Optional: Open the J2EE perspective to work with J2EE projects. Click Window > Open Perspective > Other > J2EE.
  3. In the J2EE view, select the EJB module or individual EJB to open its deployment descriptor.
  4. Find the WebSphere bindings section.
  5. In the JNDI name field, enter the name of the data source or JDBC resource you want to use.
  6. Specify whether the authentication is handled at the container or application level.
  7. Save the deployment descriptor.



In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Aug 29, 2010 7:21:45 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=vela&product=was-nd-dist&topic=tejb_defdata
File name: tejb_defdata.html