Setting the JNDI Environment Properties

There are three main ways to set the environment properties for JNDI:

  • Use an environment object in the InitialContext constructor

  • Use system properties

  • Use resource files

Resource files allow you to externally define environment properties using files that follow the java.util.Properties format. This prevents you from having to change your source code when environment properties are changed. This usually is the best approach, but not all situations are the same, so you might need to use one of the alternative methods. The following sections describe each of the approaches.

Using a Hashtable to Set Environment Properties

The first method allows the environment properties to be set inside your JNDI client ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.