JNDI DataSource Objects

A JNDI DataSource object is a file that contains the configuration details necessary to connect to a database. The DataSource object must be registered on a JNDI server, where it is identified using a JNDI name.

You can register your DataSource object directly on your application server via its JNDI service. The method used to do this varies from one application server to another.

As an alternative to directly registering DataSource objects on an application server, you can use the open-source Simple-JNDI package to create and register JNDI DataSource objects as Simple-JNDI data files. For development and evaluation purposes, we provide instructions for installing and using Simple-JNDI for this purpose. See To install and configure Simple-JNDI for details.

The components of a JNDI DataSource object are:

Type
The type of DataSource object. This is always set to javax.sql.DataSource.
Driver
The driver class.
URL
The URL to the driver location.
User
The user name required to connect to the database.
Password
The password required to connect to the database.

We recommend that you use a JNDI DataSource object to connect to your database; however, It is not required. Alternatively, you can specify a connection string directly in your application code or on the command line.