What has data source and connection pooling in Tomcat, and other containers, has to do with JNDI?

Viewed 808

I am trying to understand connection pooling (JDBC connection pooling). According to the answer in this question every container has its own mechanism. I'm also trying to understand JNDI and its implementations and whatever post or article are there it is related to locating objects in network like directories and users and here are some articles:

http://www.oracle.com/technetwork/java/jndi/index.html http://www.oracle.com/technetwork/java/overview-142035.html

Reading this article that describes how to manage a connection pooling in Tomcat container, second paragraph

javax.sql.DataSource interface is registered with the naming service based on JNDI API. A data source driver allows accessed to the database via DataSource interface. A DataSource object is looked up in the context based on registered through JNDI Resource

The question is what JNDI and networking directories has to do with instantiating an implementation of DataSource that provides a connection pooling, probably implemented via flyweight design pattern ?

Am I missing something ?

3 Answers
Related