DBCP parameters

3 views
Skip to first unread message

NW

unread,
Jan 10, 2008, 12:34:01 AM1/10/08
to osjava
Hi -

The documentation says that simple-jndi uses DBCP to provide
DataSource pooling. My question which may be the same as the thread
before this is, "How can you set typical DBCP parameters when you set
pooling=true?" For example, I'd like to set validationQuery as well as
MaxActive etc.

Tomcat 5.5 lets you set these in your context.xml when you create a
<Resource> of type DataSource and under the hood it is also using
DBCP.

On a side note, what other options are there for out-of-container
JNDI? I am using Tomcat 5.5 and would like to run out of container
Junit tests for classes which need DataSources which are currently
provided by the container via JNDI. I've spent a few hours getting my
test to work out-of-container with simple-jndi but I'm curious about
any other options. Ideally, I guess I'd like to be able to use the
Tomcat 5.5 JNDI out-of-container since it would allow me to test using/
against the same code that will be deployed but I'd read that's not
possible

Thanks,

-NBW

Henri Yandell

unread,
Jan 12, 2008, 1:19:52 AM1/12/08
to osj...@googlegroups.com
On Jan 9, 2008 9:34 PM, NW <emai...@gmail.com> wrote:
>
> Hi -
>
> The documentation says that simple-jndi uses DBCP to provide
> DataSource pooling. My question which may be the same as the thread
> before this is, "How can you set typical DBCP parameters when you set
> pooling=true?" For example, I'd like to set validationQuery as well as
> MaxActive etc.

There's nothing available at the moment. It seems like it wouldn't be
very hard to add it to PoolSetup.

I'll dig into that - though am also very open for any ideas you might
have as to how you'd like to see it implemented.

> Tomcat 5.5 lets you set these in your context.xml when you create a
> <Resource> of type DataSource and under the hood it is also using
> DBCP.
>
> On a side note, what other options are there for out-of-container
> JNDI? I am using Tomcat 5.5 and would like to run out of container
> Junit tests for classes which need DataSources which are currently
> provided by the container via JNDI. I've spent a few hours getting my
> test to work out-of-container with simple-jndi but I'm curious about
> any other options. Ideally, I guess I'd like to be able to use the
> Tomcat 5.5 JNDI out-of-container since it would allow me to test using/
> against the same code that will be deployed but I'd read that's not
> possible

A while back, Phil Steitz and I took the Tomcat 5.5 JNDI code out as
Apache Directory Naming (okay, mostly Phil); but it never reached a
release point and is lost somewhere in the SVN. Commons DBCP refers to
it as it used it for out-of-container testing.

I believe there was a Spice JNDI library somewhere, but never used it.

Hen

Henri Yandell

unread,
Feb 5, 2008, 12:39:02 AM2/5/08
to osj...@googlegroups.com

Additionally, I think the Tomcat 6 JNDI code is now available as a
separate jar.

And I came across this project the other day: http://www.mockejb.org/

JNDI and JMS mock libraries. A few years dead though by the looks of
it (admittedly, much the same could be said of simple-jndi and the
unreleased simple-jms).

Hen

Henri Yandell

unread,
Mar 22, 2008, 2:02:27 PM3/22/08
to osj...@googlegroups.com
On Fri, Jan 11, 2008 at 11:19 PM, Henri Yandell <flam...@gmail.com> wrote:
> On Jan 9, 2008 9:34 PM, NW <emai...@gmail.com> wrote:
> >
> > Hi -
> >
> > The documentation says that simple-jndi uses DBCP to provide
> > DataSource pooling. My question which may be the same as the thread
> > before this is, "How can you set typical DBCP parameters when you set
> > pooling=true?" For example, I'd like to set validationQuery as well as
> > MaxActive etc.
>
> There's nothing available at the moment. It seems like it wouldn't be
> very hard to add it to PoolSetup.
>
> I'll dig into that - though am also very open for any ideas you might
> have as to how you'd like to see it implemented.

Just committed this. First time I looked at it it seemed painful, but
a second attempt seemed a lot clearer.

I haven't seen a way to do it generically, so currently all it
supports is: dbcpValidationQuery, dbcpDefaultReadOnly and
dbcpDefaultAutoCommit.

I'll dig into how to do the MaxActive bits next.

Recorded in SJN-81.

Hen

Henri Yandell

unread,
Mar 22, 2008, 2:25:40 PM3/22/08
to osj...@googlegroups.com

Does MaxActive and the other Pool 1.3 parameters now.

Hen

Reply all
Reply to author
Forward
0 new messages