atom feed13 messages in org.apache.tomcat.usersRe: Datasource and Initial Context
FromSent OnAttachments
Peng Tuck KwokDec 2, 2002 8:09 pm 
Craig R. McClanahanDec 2, 2002 8:23 pm 
Peng Tuck KwokDec 2, 2002 8:38 pm 
maninder s batthDec 2, 2002 8:40 pm 
Ram KochharDec 2, 2002 8:45 pm 
Pae ChoiDec 2, 2002 9:41 pm 
Craig R. McClanahanDec 2, 2002 10:30 pm 
Paul CampbellDec 2, 2002 10:32 pm 
Triptpal Singh LambaDec 3, 2002 10:56 am 
Reynir HübnerDec 3, 2002 10:58 am 
Turner, JohnDec 3, 2002 10:58 am 
Ram KochharDec 3, 2002 9:13 pm 
maninder s batthDec 3, 2002 10:32 pm 
Subject:Re: Datasource and Initial Context
From:Craig R. McClanahan (crai@apache.org)
Date:Dec 2, 2002 10:30:42 pm
List:org.apache.tomcat.users

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

Date: Mon, 02 Dec 2002 20:41:10 -0800 From: maninder s batth <anyw@netscape.net> Reply-To: Tomcat Users List <tomc@jakarta.apache.org> To: Tomcat Users List <tomc@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