Grea answers, thank you. Having a higher acquireIncrement makes a lot more sense the way you explained it than in the actual docs. Also I can't use a testTable since most of the connections i am using are read-only, but adjusting the timeouts seems like this should fix the issue.

I am going to give these a shot today.

Also, what is the status of development on c3p0? It seems like not much has happened with dbcp or c3p0 in the last couple years, and mchange.com seems defunct (though I can get to the old docs through google). Is this being hosted or developed anywhere? Are there any long-standing bugs or reasons why it was never pushed to a 1.0 release?

Thanks,
-+ liam +-


On Sat, Dec 5, 2009 at 6:51 PM, Steve Waldman <swaldman@mchange.com> wrote:
hi,

i'm sorry for the much delayed response.

you should read this, if you haven't already:

http://www.mchange.com/projects/c3p0/#configuring_connection_testing

rereading, it's not as clear as it should be...

basically...

1) decide how you want Connections to be tested. on mysql and many
other databases, you can use a preferredTestQuery of SELECT 1. If you
want an actual query against an empty table, it's convenient to define
an automaticTestTable. The defaukt Connection test (if you do none of
that) is slow.

2) decide on a Connection testing regime. testConnectionOnCheckout is
safest, but adds overhead to client queries. Setting a short
idleConnectionTestPeriod and testingConnectionOnCheckin leaves open a
small window for a Connection failure to go unnoticed, but in practice
is very reliable.

3) hibernate's c3p0.timeout maps to maxIdleTime. maxIdleTime should be
much longer than idleConnectionTestPeriod. maxIdleTime causes
Connections to be closed (and perhaps reacquired from the database,
depending on whether the min # of Connections remain and what the load
is like). if maxIdleTime is shorter than idleConnectionTestPeriod,
Connections will never be tested, just recycled. If you test, you
needn't use idleConnectionTestPeriod at all, as Connections will
automatically be closed if they fail a test.

    smiles,
        Steve

On Nov 25, 2009, at 6:23 AM, rafael liu wrote:

> Hey, Steve
>
> Sorry to bother, but I couldn't find this info anywhere on the net..
> The thing is I'm using C3P0 with Hibernate to handle conection
> pooling but I got some IO Exceptions (Connection reset). I've found
> some references advicing the use of timeout and idle_test_period,
> something about idle_test_period being less than timeout. It says
> that timeout can expire a connection but does not clean it, because
> idle_test_period didn't run yet. Is that right?
>
> Congrats for this cool framework!
>
> Cheers,
>
> --
> Rafael Liu
> +55 61 9608-7722
> http://rafaelliu.net


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
c3p0-users mailing list
c3p0-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/c3p0-users