Home
Using the data source in the server
The application is configured to use the data source defined in the enterprise application RAD75JSFEAR. For the final application we want to use the data source configured in the server with the JNDI name jdbc/itsobank.
To configure the JSF application for the data source in the server, perform these steps:
Open the ibm-web-bnd.xml file (in RAD75JSFWeb/WebContent/WEB-INF). Change the resource reference to: <resource-ref name="ITSOBANKderby"
binding-name="jdbc/itsobank">
<authentication-alias name="ITSOBANKderby" />
</resource-ref>
Save and close the file.
Right-click RAD75JSFWeb and select JPA Tools Æ Configure Project for JDBC Deployment:
Click OK in the Cannot connect to connection profile ITSOBANK warning.
Click Cancel in the Properties dialog.
In the Set up connections for deployment dialog:
Select ITSOBANKderby for the Connection.
Clear Deploy JDBC Connection information to server (Figure | 6-7).
Figure 16-7 Deployment of JDBC connection
Click Configure project's database connections.
In the Properties for RADJSFWeb dialog, click Edit for Runtime connection details (Figure | 6-8).
Figure 16-8 Runtime connection details
In the Runtime Connection dialog, clear Deploy database and connection properties when application is run on unit test server, and click Finish (Figure | 6-9).
Figure 16-9 Deployment of the runtime connection
The runtime connection is removed. Click OK in the Properties dialog.
Click OK in the Set up connections for deployment dialog.
Open the persistence.xml file (in WebContent/WEB-INF) and change the data source JNDI name to jdbc/itsobank. <persistence-unit name="RAD75JSFWeb">
<jta-data-source>jdbc/itsobank</jta-data-source>
Right-click RAD75JSFEAR and select Java EE Æ Open WebSphere Application Server Deployment:
Select Generated Derby JDBC Provider and verify that there is no data source configured.
Close the editor.
Note: Connection information is stored in the .wdo-connections file of the RAD75JSFWeb project. You can only see that file by changing the filter in the Enterprise Explorer (Down Arrow icon Æ Customize View, then clear .*resources).
ibm.com/redbooks