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 datasource with JNDI, others can discover it through a JNDI lookup and use it.
You can create the JNDI data source as you create your data service: Follow the steps from 1 to 3 in creating data services using various data sources. When you get to the Add New Data Source screen, select JNDI as the data source type. The JNDI-specific options will now be available for editing as shown below.
The options in the above window are explained below:
JNDI Context Class: The corresponding context factory class
Provider URL: The URL which specifies the location of a resource on the Web.
Resource Name: The name of the JNDI resource
You can also expose a RDBMS Carbon datasource as a JNDI datasource using the Configure > Datasources menu of the management console. For instructions, see Adding datasources .
To write a query to this datasource, see Writing Data Service Queries.