Hi,
from my point of view, you have 2 options:
1) Better configure Hibernate connection pooling (c3p0)
2) Use tomcat connection pooling
We have been on that issue for a long time in the past.
We resolved with option 1, but the testing / tuning of c3p0 with mySQL is very
trivial.
These have been our working config:
<!-- C3P0 config -->
<!-- Connection Pooling -->
<property
name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="c3p0.min_size">5</property>
<property name="c3p0.max_size">50</property>
<property name="c3p0.initial_pool_size">20</property>
<property name="c3p0.timeout">100</property> <!-- seconds -->
<property name="c3p0.max_statements">0</property>
<property name="c3p0.acquire_increment">3</property>
<!-- this property forces the revalidation of a connection
after the given amount of time (in secs) -->
<!-- it must be set to LESS than the wait_timout setting for
the mysql server (this setting defaults to 28800 secs (8 hours)) -->
<property name="c3p0.idle_test_period">100</property> <!--
seconds -->
<!-- end of C3P0 config -->
HTH,
matteo
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Anton Matheis
Sent: mercoledì, 26. gennaio 2011 13:33
To: Magnolia User-List
Subject: Re: [magnolia-user] MySQL Persistence
Hi,
we had a problem with Hibernate and MySQL: the database connection
gets closed after 8 hours when it's idle. So on our dev server, after
8 hours idle, the connection got closed and we got errors with our
applications.
So we googled and found that:
http://www.databasesandlife.com/automatic-reconnect-from-hibernate-to-mysql/
which is not 100% true because here
http://stackoverflow.com/questions/3123962/hibernate-and-mysql-timeout-problem-doesnt-work-with-c3p0
they state that you have to implement a custom LocalSessionFactoryBean
to get c3p0 working because of a spring bug.
We did that and now we don't have the connection problems with our
applications anymore. But: we get that same error message as you do
and now my first guess would be that in our case while hibernate is
now connected via c3p0, magnolia is not and thus the problem now
occurs for our magnolia instance (which uses MySQL).
tldr: MySQL disconnects after 8 hours idle without usage of c3p0 ->
problem for magnolia?
Anyone having similar setup/problems?
Greetings,
Anton
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------