I need to know if my understanding on the above is correct.
In a connection pool you set multiple connections with the use of java.sql.Datasource.
In jdbc we directly specify the connection url and oracle.jdbc.driver.OracleDriver and it's always one connection, where another request has to wait until the connection has finished processing.
And with JNDI it's similar to direct jdbc where we refer the jdbc setting via a name, so that we can specify the connection url and other setting in the application server and not have them bound to the application, right?
Well these are two different things.
JDBC is Java Database Connectivity API, while JNDI is Java Naming and Directory Interface API.
The main thing here is that in a JNDI directory you're actually storing a JDBC DataSource, so, you're simply using JDBC to obtain a Connection via JNDI lookup.
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).
You access this context via names, obtaining stored objects, is good to share things among different modules.
Application Servers usually have a JNDI Context for sharing global objects among 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).