dcsimg
How does connection pool work in JNDI?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Wednesday, August 14, 2002 05:45 AM

Hi, To use connection pooling through JNDI the code below seems to be enough: Context ctx = new InitialContext(); ocpds = (OracleConnectionPoolDataSource) ctx.lookup("jdbc/pool/OracleDS"); Where does jdbc/pool/OracleDS come from? If it is a naming service that uses file system, as far as I know, there must be jdbc/pool/OracleDS folder hierarchy. But I couldn't find. I also could not find "fscontext.jar" is which required as file system service provider. So I thought that it could not be naming service based on file file system service provider. But when I look at the line    More>>

Hi,


To use connection pooling through JNDI the code below seems to be enough:



			
Context ctx = new InitialContext();
ocpds = (OracleConnectionPoolDataSource)
ctx.lookup("jdbc/pool/OracleDS");



Where does jdbc/pool/OracleDS come from?


If it is a naming service that uses file system, as far as I know, there must be jdbc/pool/OracleDS folder hierarchy. But I couldn't find. I also could not find "fscontext.jar" is which required as file system service provider. So I thought that it could not be naming service based on file file system service provider.


But when I look at the line



			
Context ctx = new InitialContext();



I see that it cannot be LDAP, COS or RMI either. Because environment hashtable is not passed to InitialContext().


What is going on? Please help me.


Thanks a lot.

   <<Less

Re: How does connection pool work in JNDI?

Posted By:   Lasse_Koskela  
Posted On:   Thursday, August 15, 2002 10:51 AM

The jdbc/pool/OracleDS comes from your appserver configuration files. There is usually an XML file named datasources.xml or config.xml or whatever, which contains the definitions for all DataSources used by the application(s).


When you get the InitialContext and say lookup(String), the appserver/naming service searches the Java object binded with the given name and returns it to your code. You really don't need to know where the object comes from - that's the whole idea.


If you just say new InitialContext(), the required parameters for locating the naming service are read from some system properties defined at startup time.

About | Sitemap | Contact