Hi,
I hope you can help me. I have battling connection timeout issue with Mysql for a month now. I am using hibernate 2 with c3p0 connection pool. Hibernate config file below:
<session-factory>
<!-- properties -->
<property name="session_factory_name">jdbcSessionFactory</property>
<property name="jdbc.use_scrollable_resultset">true</property>
<property name="cglib.use_reflection_optimizer">false</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>
<property name="query.substitutions">true=1, false=0</property>
<!-- connection parameters -->
<property name="connection.provider_class">net.sf.hibernate.connection.C3P0ConnectionProvider</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/mydb?autoReconnect=true</property>
<property name="connection.username">username</property>
<property name="connection.password">password</property>
<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.failOverReadOnly">true</property>
<property name="connection.is-connection-validation-required">true</property>
<!-- connection pool settings -->
<property name="c3p0.minPoolSize">5</property>
<property name="c3p0.maxPoolSize">60</property>
<property name="c3p0.timeout">600</property>
<property name="c3p0.max_statement">300</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- mapping files -->
<mapping resource="com/planet/struts/beans/or-mapping.hbm.xml"/>
<mapping resource="com/planet/struts/beans/admin/or-mapping.hbm.xml"/>
</session-factory>
After certain period of time connection timesout, then once refreshed it works fine. Any suggestions are appreciated.
Thank you.
|