Simple-JNDI

The Simple-JNDI package implements JNDI as a client library that uses Java property files to store data source object descriptions.

Installing and Configuring Simple JNDI

  1. Download Simple JNDI 11.4.1 or later from the Open Source Java components Web site.
  2. Unzip to a local or shared location.
  3. Using any text editor, create a jndi.properties file containing the following:
    java.naming.factory.initial=org.osjava.sj.SimpleContextFactory
    org.osjava.sj.root=configFileDirectory
    Where configFileDirectory is the full path to the folder containing the jndi.properties file.
  4. Add your simple-jndi-version.jar file to the JVM Build Path in the Eclipse project properties, or on the CLASSPATH property of the Eclipse Debug or Run configuration.
  5. Do one of the following:
    • Compress the jndi.properties configuration file into a .zip file, and add the directory containing the .zip file using Add External JARs
    • Add the directory containing the jndi.properties file using Add External Class Folder
  6. Again, using any text editor, create one data file for each data source using the following naming convention:

    dataSourceName.properties

  7. Include the following in each data file:
    type=javax.sql.DataSource
    driver=driverName
    url=JDBC-URL
    user=userID
    password=password
    Where:
    driverName The name of the JDBC driver.
    JDBC-URL A URL that identifies the server and database.
    userID The user ID required to log on to the server and database. Optional if not required by the database.
    password The password that accompanies the specified user ID. Optional if not required by the database.
  8. Save each file to the same folder as your jndi.properties file.

For complete information on installing and configuring Simple-JNDI, see the documentation provided with the software.

Sample Data Files

These sample data files represent connection properties for three typical data source connections:

DB2 with DB2-Express
File name: DB2.properties
    type=javax.sql.DataSource
    driver=com.ibm.db2.jcc.DB2Driver
    url=jdbc:db2://localhost:50000/sample:retrieveMessagesFromServerOnGetMessage=true;
    user=userName
    password=password
MSSQL with SQL Server Express
File name: MSSQL.properties
For Windows environments 
			 :
    type=javax.sql.DataSource
    driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
    url=jdbc:sqlserver://localhost\SQLEXPRESS;database=Northwind;integratedSecurity=true;
    user=
    password=
For UNIX environments 
			 :    
    type=javax.sql.DataSource
    driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
    url=jdbc:sqlserver://remotehost\SQLEXPRESS;database=Northwind;integratedSecurity=true;
    user=
    password=
ORA with Oracle XE
File name: ORA.properties
    type=javax.sql.DataSource
    driver=oracle.jdbc.driver.OracleDriver
    url=jdbc:oracle:thin:@localhost:1521/XE
    user=userName
    password=password