How to Setup Global JNDI Mapping
for Oracle JDBC Connection Pooling
with Tomcat

by Gregg Lagnese, MicroDeveloper, Inc.
May 16, 2005 v1.3
 
Single Page Variant   Next -> Configuration
 
Preface

This document was originally created to outline the implementation of JNDI for Oracle connections. After working with both 5.0 and 5.5 configurations extensively, and with JDK 1.4.2 versus 1.5, I have come to realize that there are really two ways of implementing the global database JNDI configuration. The only difference I found was that the 5.0.x installation did not always work without a modification to the context web.xml file (Step 3). In 5.5 this was not necessary.

While there are apparently several suggested ways to accomplish global JNDI connectivity, this way seems to work consistently on a variety of platforms. This how-to assumes that you want the JNDI sources available to all contexts.

There are two possible ways to perform JNDI mapping; one uses a fixed logon, the other a dynamic one.  In the later case you will be required to add the necessary code to collect the proper username and password.  However, in doing this, configuration files may be used that can contain encrypted passwords thereby securing the database in the event that the Tomcat server is compromised.

 
Nomenclature:
<name> = where you substitute the necessary value
[name] = an optional element or parameter


Note
: All examples are given in Unix path notation, use Windows notation where applicable.
 

Section Index
Configuration

Steps

Testing the changes
Troubleshooting
Making a User Dependent Connection
 
Single Page Variant   Next -> Configuration
 
Revision History
05.16.05.01     glagnese     Defined differences between 5.0 and 5.5 implementations. Added additional troubleshooting tips. Split into dual format.
03.08.05.01     glagnese     Corrected typo showing javax.sql.Factory incorrectly in syntax and incorrect JNDI parameter "username" that should be "user". Verified and tested.
01.21.05.01     glagnese     Created.

Gregg Lagnese is an senior executive and developer for MicroDeveloper, Inc. and has been developing software for Oracle databases for more than 14 years.