tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Lucia" <timlu...@yahoo.com>
Subject RE: Connection Pooling Question
Date Wed, 21 Feb 2007 18:45:10 GMT

> -----Original Message-----
> From: Marc Farrow [mailto:marc.farrow@gmail.com]
> Sent: Monday, February 19, 2007 3:56 PM
> To: tomcat-users
> Subject: Connection Pooling Question
> 
> Slightly off topic, but the core of what I want is being done in the
> source
> code of Tomcat. I am trying to use the Apache Commons DBCP classes to
> create
> my own connection pooling factory that I can use within my servlet
> container
> (Tomcat) and also in stand alone programs.  I see how the Datasource that
> Tomcat creates when you use its connection pooling is put into a JNDI
> context, but I have scoured over the Tomcat source code and I have not
> been
> able to find the code that is actually doing the context bindings and
> where
> the information is being held.  Can someone point me in the right

I have done something similar, which may be helpful or of interest to you.
For our unit tests, I have used the standard JNDI jars from Tomcat
(naming-factory, naming-factory-dbcp, naming-resources) and in the
BaseTestCase (extends junit.framework.TestCase) I create and load the JNDI
context from a property file.

This allows the rest of the classes-under-test to function as if they were
running under the Tomcat container and allows for the regular and complete
JNDI lookup of all our DataSources.  I used to use the JavaRanch jndi helper
but it only supports a single DataSource.

I would be happy to share the code with anyone who may want it.  It's 200+
lines of code, and I wouldn't post the whole thing to the list, so send me
e-mail off-list if you want a copy.

> direction
> of the source code to review and also any "advanced" JNDI tutorials that
> teach you how to bind to a context that can be reused by external
> resources
> (meaning another JVM).

For one JVM to see or provide JNDI lookups for another would require a
network/port aware JNDI scheme.  I'm not aware of one, but wouldn't be
surprised if one exists either.

> 
> Also, has anyone seen or done this type of solution before?
> 
> Thank you,
> 
> --
> Marc Farrow

Tim



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message