Hi Gabriel,

Did you get an answer to this?  I have a similar problem and was
considering using the initialPoolSize configuration to establish
connection in advance of my clients' application starting.


[c3p0-users] Opening connections before they are needed
From: gabrielx <gabrielx@ye...> - 2009-07-07 01:05
I have a request/reply service that is very fast except when it tries
to get a connection from C3P0 and has to wait for C3P0 to make a new
DB connection. I'm trying to figure out how to minimize creating DB
connections lazily, instead I'd like to have an admin thread open a
new connection when the number of idle connections is less than N.

I haven't found anything like this in the C3P0 documentation. Did I
miss something in the docs or is this a feature that can be added?

Alternatively, I could implement this functionality in my service if I
knew how to force C3P0 to add a new connection to the pool. I don't
want to call PoolBackedDataSource.getConnection() because that could
consume an idle connection that one of my service threads might need
soon. Is there an API I can use to force a new connection to be added
to a C3P0 pool?

Some background. Every once in a while clients of my service time out
waiting for a reply because my service has to wait for C3P0 to make a
new DB connection. I don't want to fix this problem by setting
minPoolSize to a large number because I share this DB with other
services and I want to be a good citizen and not consume more
resources than I need (the exact number of connections my service
needs varies with time). I also tried increasing acquireIncrement,
but that actually made things worse.