|
|
Locate your JDBC DataSource in WebSphere Application Server using JNDI (continued)
The only problem with this method is that in order to refer to your DataSource by an alias name, you have to define the alias. You do that when you set up your Web application, and the easiest way to perform this task is through WebSphere Studio Application Developer.
If you open your Web application project in WebSphere Studio Application Developer, you can bring up the Deployment Descriptor in edit mode by double clicking on the Deployment Descriptor entry in the project tree. Using the tabs at the bottom of the Deployment Descriptor edit pane, navigate to the References panel.
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 picture for a 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.
For more than 20 years, David Gewirtz, the author of Where Have All The Emails Gone? and The Flexible Enterprise has analyzed current, historical, and emerging issues relating to technology, competitiveness, and policy. David is the Editor-in-Chief of the ZATZ magazines, is the Cyberterrorism Advisor for the International Association for Counterterrorism and Security Professionals, and can be reached via email at david@zatz.com.
[ Prev ]
|
|
|
|