About this task
The session bean creates the resource references for the datasources,
which the Container-Managed Persistence (CMP) enterprise bean uses through
the proxy datasource, then specifies the datasource used in the transactions.
The
CMP EJB will use two DB2 datasources, one to access west coast database westtest,
and the other to access east coast database easttest. Therefore, we
need to create two datasource references for the session bean AccountTransaction.
Procedure
- Select AccountTransaction from the beans list on the References tab
of the EJB deployment descriptor.
- Click Add....
- Select Resource reference from the panel and then click Next.
- Define the Name as jdbc/myDS1.
- Define the Type as javax.sql.Datasource.
- Define the Authentication as Container.
- Define the Sharing scope as Shareable.
- Click Finish.
- Repeat the previous step to create a resource reference jdbc/myDS2.
- Repeat the previous step to create a resource reference jdbc/proxyds.
Results
Now, you have created two resource references for the session bean AccountTransaction.
What to do next
On the references panel, set the WebSphere binding for jdbc/myDS1 to jdbc/WestDS,
set the WebSphere binding for jdbc/myDS2 to jdbc/EastDS, and
set the WebSphere binding for jdbc/proxyds to jdbc/dsSampleDSProxy.