Chris,

I think I am looking at it the wrong way. I have been looking at it as a
collection of static connections that are managed. i.e., putting 8
connections in an array or hashtable and grabbing them when needed and
letting something check them every so often to keep them refreshed. Earlier
in the post, Ziggy suggested that the pooling mechanism is a dynamic caching
system; and looking at it as a caching system is starting to make more sense
to me. The api makes more sense from this perspective. where it just keeps x
number of connections around at any given point in time. I don't have to
have connections from the get go, but it would be nice. That means the first
person to hit the app has to take the hit on the creation of the first
connection or two. Which, I suppose isn't bad.

As far as the initialSize parameter, do I just append those to the
datasource under the Resource element in the web.xml? and will that actually
create some initial connections in the pool? Do I need to set up init-params
and get them that way?  The thing about the configuration reference is that
I could not really tell where in the config to put those various elements,
maybe it doesn't matter.

-Chris



-----Original Message-----
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Thursday, September 10, 2009 12:23 PM
To: Tomcat Users List
Cc: chriswile...@gmail.com
Subject: Re: Database Connection Pooling initialization with dbcp

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris,

On 9/9/2009 12:01 PM, Chris Wiley wrote:
> My question is this: Am I to assume that I need to OPEN and CLOSE x
> number of connections in the init section of the servlet to load the pool
> with live connections?

No, this can be done with configuration. Unless you have changed your
config, Tomcat uses commons-dbcp whose configuration reference can be
found here: http://commons.apache.org/dbcp/configuration.html

I think you want to take a look at the "initialSize" and "minIdle"
parameters.

Is there any reason why you absolutely need those connections to all be
available right away? Laziness can sometimes be beneficial... :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqpNdkACgkQ9CaO5/Lv0PAZQACeMOlUmLcr/9eTfUTxeNuv1mpu
0pkAoLg8687dcxFcYa/Ki1aeApv8xELL
=WerZ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to