O'Reilly logo

Special Edition Using Enterprise JavaBeans™ 2.0 by Brian Keeton, Chuck Cavaness

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required