The latest c3p0 has a new property, this is fromt he c3p0 developer a while back:

I've added a new configuration property, idleConnectionTestPeriod,
which if set to a number of seconds greater than zero, causes idle
connections in the pool to be periodically checked, and discarded if
they are broken. Like all c3p0 configuration parameters, you can set
this programatically using the PoolConfig, or just override the
built-in defaults by placing a file called c3p0.properties on the top
level of your classpath, with a lines like

c3p0.idleConnectionTestPeriod=1800
c3p0.maxIdleTime=7200


Not sure if hibernate supports the idleConnectionTestPeriod property yet though, but if not, it probably should. The problem you are having is that mySQL invalidates connections after 8 hours of no use or something.


Travis


Dave Tilley wrote:



Ok,


So it seems to me that to use C3P0, you must set the following four paramaters.

hibernate.c3p0.max_size =maximum connection pool size

hibernate.c3p0.min_size = minimum connection pool size

hibernate.c3p0.timeout = maximum idle time

hibernate.c3p0.max_statements =size of statement cache


But when people say you must "enable connection validation", does that mean setting C3P0_VALIDATE_CONNECTION to some very simple query? ie... is C3P0_VALIDATE_CONNECTION the same as DBCP_VALIDATION_QUERY ??? Are there any other params that need to be set to get C3P0 connection pooling working properly and validating connections?




Alternatively, if one chooses to use DBCP and the MySQL autoReconnect=true JDBC URL option, do you still have to set hibernate.dbcp.testOnReturn and hibernate.dbcp.testOnBorrow to true???

Actually, if someone could list exactly what the minimal set of DBCP params are that need to be set (and what are reasonable values for some of these), that would be a big help!!! Right now, i'm using:

"hibernate.dbcp.maxActive"
"hibernate.dbcp.maxIdle"
"hibernate.dbcp.maxWait"
"hibernate.dbcp.testOnBorrow"
"hibernate.dbcp.testOnReturn"
"hibernate.dbcp.validationQuery"

Do i need to set any others????



thanks,

-dave







Gavin King wrote:

Someone has claimed that this parameter doesn't work if autocommit is
disabled (Hibernate always disables autocommit). I don't know if this is
true or not.


You can pass autoReconnect=true in the JDBC URL which makes the
MySQL-driver
attempt to reconnect if the connection dies.

See:
http://www.mysql.com/documentation/connector-j/index.html#id2800782

/Ludde





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel





-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

.


-- Travis Reeder



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to