On Mon, 2 Dec 2002, maninder s batth wrote:

> Date: Mon, 02 Dec 2002 20:41:10 -0800
> From: maninder s batth <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Datasource and Initial Context
>
> hi i am using my own DataSource class which cannot be configuered by xml
> file
> i need to programatically configure it . since tomcat provides read only
> context
> , is there any way i can use tomcat's jndi implementation, as of now i
> am using
> filesystem provider for datasource, is there any other open source
> provider for
> jndi which is more scalable and faster than file system provider?
> thanks
>

Tomcat will let you use any resource factory you want, as long as it (or a
wrapper class around it) implements the standard JNDI object factory
interface (javax.naming.spi.ObjectFactory).  If you grab a source distro
of commons-dbcp <http://jakarta.apache.org/commons/dbcp> and look at the
sources for org.apache.commons.dbcp.BasicDataSourceFactory (the default
object factory for data sources in Tomcat) you can see that it's actually
pretty easy to create such a wrapper class around your own data source
implementation.  Then, you tell Tomcat to use your factory by using a
"factory" parameter in the <ResourceParams> section of server.xml.

For more info about JNDI resources in Tomcat, including a simple example
of building your own factory, see:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.html

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to