File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Tomcat JNDI datasource ,where is the managed datasource object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat JNDI datasource ,where is the managed datasource object?" Watch "Tomcat JNDI datasource ,where is the managed datasource object?" New topic
Author

Tomcat JNDI datasource ,where is the managed datasource object?

Guogang Fan
Greenhorn

Joined: Aug 17, 2009
Posts: 7
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?

Guogang Fan
Greenhorn

Joined: Aug 17, 2009
Posts: 7
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 .

some one please help me to understand it.

sorry for my poor english.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat JNDI datasource ,where is the managed datasource object?
 
Similar Threads
DBCP deadlock on BasicDataSource.getConnection()
Charset1104D00000/Cp1252 is not supported by the JVM.
Problem with EJB 3. Name not bound error
JDBC Exception in JNDI lookup
Can I get the datasource without referencing the actionServlet???