Glenn, Asar, In the meantime, I created another DataSourceFactory called a "named" datasource factory. It's simply a factory that keeps track of DataSource objects in a Hashtable keyed by a name passed in from the server.xml <Reference Param> block.
If another context tries to reference a DataSource with the same name, the factory will look it up in the Hastable and return the existing DataSource. It's not a very glamorous approach, but it seems to work for now. In particular, chaching DataSource object at the Factory level might not be a good idea. I'm attaching the file here in case it is of interest or use to anyone on the list, although the Commons mailing list is probably a more appropriate place to post it. If you have any ideas or comments about this approach, I'd be very interested in reading them. Thnaks, Ike ______________________________________ Isaac Arias - CTO Tokenzone, Inc. --- [EMAIL PROTECTED] wrote: > > Only it doesn't work in 4.1.x!! > > See > http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11662 > > > On 17/08/2002 03:20:17 Glenn Nielsen wrote: > > No, I don't. > > > > The Host DefaultContext only defines the default > context configuration. > > Any resources defined are instantiated for each > individual context. > > > > GlobalNamingResource does indeed instantiate a > resource which can > > be shared. > > > > So no, you can't do what you want to do with > Tomcat 4.0.x. > > > > You would have to upgrade to 4.1.x. > > > > Regards, > > > > Glenn > > > > Isaac Arias wrote: > > > Hi All, > > > > > > A couple of weeks ago I wrote about a Poolman > > > DataSource factory for Tomcat, but the latest > version > > > of Poolman ended up being too buggy for > production > > > work. We've since moved to DBCP from Commons. > > > > > > I'm trying to configure a global DB pool for > multiple > > > contexts and I'm having trouble using the > > > BasicDataSourceFactory with Tomcat 4.0.4. > > > > > > Since Tomcat 4.0.x doesn't support the > > > <GlobalNamingResources> structure (like 4.1.x) > which > > > sounds like the right thing to use, I'm placing > the > > > DBCP <Resource> in a <DefaultContext>. However, > it > > > appears that every time a context tries to > access the > > > pool, DBCP creates a brand new pool for that > context > > > instead of sharing a global one. > > > > > > Any ideas on how to configure this on 4.0.4? I > guess > > > one option would be to modify the > > > BasicDataSourceFactory, but maybe there's a way > to do > > > it in the config files in 4.0.4. Is anybody > using DBCP > > > as a global pooler for multiple contexts? > > > > > > Thanks a lot! > > > > > > Ike > > > _________________________________________ > > > Isaac Arias > > > Tokenzone, Inc. > > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > HotJobs - Search Thousands of New Jobs > > > http://www.hotjobs.com > > > > > > -- > > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > ------------------------------------------------------------- > --- > Visit our Internet site at > http://www.reuters.com > > Any views expressed in this message are those of > the individual > sender, except where the sender specifically > states them to be > the views of Reuters Ltd. > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com
NamedDataSourceFactory.java
Description: NamedDataSourceFactory.java
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>