When tomcat running,we can get a connection from a datasource .
where the datasource come from?
is that some thread started by tomcat always running ,when web app request a connection ,the thread provide it from it's connection pool?
Joined: Aug 17, 2009
when we bind a datasource object to a Name within a context,is that means the datasource was converted into byte stream and stored in somewhere?
when we lookup a object by it's Name,is that means we revert the byte stream back to a Object ?
but i saw the tomcat source code ,bindings is just a HashMap .
Tomcat allows you to define resources which will then be cataloged into its JNDI repository. There's a special section of the Tomcat documentation that supplies detailed information on how to define a DataSource resource object in Tomcat.
Tomcat will use this information to construct and initialize the datasource and to publish it in JNDI under the name you supply as part of your datasource definition. For example, if your datasource definition defines that datasource as being named "jdbc/mydatasource", then the web application could make a JNDI lookup request for "java:comp/env/jdbc/mydatasource". This would then return the datasource interface which you would use to acquire connections from the datasource connection pool.
An IDE is no substitute for an Intelligent Developer.