Java Naming and Directory Interface (JNDI) is a Java API (application programming interface) providing naming and directory functionality for Java software clients to discover and look up data and objects via a name. WSO2 Data Services Server supports JNDI InitialContext implementation by inheriting the JNDI implementation of Tomcat (http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html). JNDI helps decouple object creation from the object look-up. When you have registered a data source with JNDI, others can discover it through a JNDI lookup and use it.
JNDI datasources allow you to create a data service using a JNDI resource as the data storage type.
You can get the Add New Datasource screen shown below on the management console by executing steps 1 to 3 in creating a data service. Then, select JNDI Datasource as the Datasource Type. It opens the JNDI-specific options as shown below:
The options in the above window are explained below:
JNDI Context Class:
Provider URL:
Resource Name:
You can also expose a RDBMS Carbon data source as a JNDI data source using the Configure > Data Sources menu of the management console. For instructions, see Configuring Data Sources.
To write a query to this data source, see Writing Data Service Queries.