tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Datasource and Initial Context
Date Tue, 03 Dec 2002 06:31:04 GMT

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

> Date: Mon, 02 Dec 2002 20:41:10 -0800
> From: maninder s batth <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> 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 <> 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:


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message