Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

[FRIDAY] DBCP configuration

Wesley Wannemacher

2007-01-05

Replies:

Hello, I have a Lazy Friday question for everyone...

When configuring the database connections, where do you tend to put
them?

In my situation, I usually configure the connection pool in the web-app
context and find them with JNDI. However, I am moving to iBATIS for my
most recent project and iBATIS has the ability to create a DBCP pool on
it's own (rather than in the web-app context).

In the past, I could use a read-only connection in the context both for
my own coding and I could have Tomcat create a JNDI realm for
authentication. So, I would have to have a database connection
configured by Tomcat. In my current project, I am not going to use
Tomcat's Container managed security, so I don't need the database
connections available to Tomcat, so I am leaning toward using the
built-in iBATIS capability.

I am asking because I don't want to have to change later when I find
something else that I am currently forgetting about.

The main reason that I am currently leaning toward the iBATIS solution
is that I am finding jUnit tests difficult to write for my persistence
layer. If I tell iBATIS to find the database connections in the Tomcat
context, iBATIS can't find them when I am running unit tests (since the
unit tests don't load the tomcat context).

Opinions?

-Wes

--
Wes Wannemacher
Director of Operations
Double A Trailer Sales, Inc.
wesw@(protected)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.