tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
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 <anywhereinfo@netscape.net>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> 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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message