Question: What is the Difference Between JNDI and JDBC?
Answer: JDBC is java database API, while JNDI is java native directory API. (What is the Difference Between JNDI and JDBC)
In short words: JDBC is Database realm, JNDI lets you store Objects in a virtual context (the Directory) that can be local, remote (Implementation details usually don’t matters).
Application Servers usually have a JNDI Context for sharing global objects amon different application, Connection Poolers happen to be one of the most clear example of why sharing via JNDI is good. (Define 1 connection pooler, share between several webapps)
JNDI is the directory which contains the list of objectsdefined on the server. When the user requests for a connection pool, the code (pivotal training) would look for the object on the JNDI and would get the requested connection pool from the datasource. JDBC is the one which does all the interactions with the database. An application will lookup the JNDI to get a connection pool for it to interact with the database.