Friday, October 1, 2004

Locate your JDBC DataSource in WebSphere Application Server using JNDI

On the References panel, use the tabs at the top of the screen to bring up the Resources section that you see in Figure A.

FIGURE A

Use WebSphere Studio Application Developer to create your DataSource alias. (click for larger image)

Click on the Add button to create your new DataSource alias.

In the Resource References section, enter the name of your new alias. This will be the name that you'll specify in your look-up code to locate your DataSource.

In the Details section, use the Browse button to locate and select javax.sql.DataSource, then set the Authentication to Application.

In the WebSphere Extensions section, set the Connection Management to Default.

In the WebSphere Bindings section, specify the actual JNDI name of your DataSource.

When you're finished, close and save the Deployment Descriptor and you're ready to redeploy your application, or test it right in Studio using the WebSphere Test Environment.

There are obviously other values that you can use for many of these properties, but these settings will get you going. For further information on the purpose and possible values for the various settings available for a JDBC resource alias, take a look at the WebSphere Application Server Information Center at http://publib.boulder.ibm.com/infocenter/ws51help/index.jsp.