It may be that connection that is in the pool is stil open, but database
already closed it by timeout. You need to chek timeouts in the pool so that
it be less than in the database.

On Saturday, August 10, 2013, Nomen Nominus wrote:

> Here is my problem. I have a very classical configuration where a webapp
>
> with some Hibernate code in it accesses a MySQL DB. Everything is
>
> installed in Tomcat 6.
> I even acquired c3p0 connection pooling with the following configuration:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
> Configuration DTD//EN"
>    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";>
> <hibernate-configuration>
>
> <session-factory>
>
>     <!-- Settings for MySql DB -->
>
>     <property
> name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
>
>     <property
> name="hibernate.connection.url">jdbc:mysql://localhost:3306/myDB?autoReconnect=true</property>
>     <property name="hibernate.connection.username">myUsername</property>
>
>     <property name="hibernate.connection.password">myPass</property>
>
>     <property
> name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
>     <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
>     <property name="hibernate.connection.pool_size">5</property>
>     <property name="show_sql">true</property>
>
>     <property name="hibernate.c3p0.idle_test_period">1800</property> <!--
> In seconds -->
>
>     <property name="hibernate.c3p0.min_size">5</property>
>
>     <property name="hibernate.c3p0.max_size">20</property>
>
>     <property name="hibernate.c3p0.timeout">2400</property>
>     <property name="hibernate.c3p0.max_statements">50</property>
>
> </session-factory>
>
> </hibernate-configuration>
>
> After some time, ( around 60 secs ) Hibernate complains about dropped
> connections, the
>
> error message looks like this :
>
> com.mysql.jdbc.CommunicationsException : Communications link failure The
>
> last packet successfully received from the server was
> milliseconds ago. The last packet sent successfully to the server was 0
>
> milliseconds ago.
>
> java.io.EOFException : Can not read response from server. Expected to
>
> read 4 bytes, read 0 bytes before connection was unexpectedly lost.
>
>
> Refeshing the page once or twice usually fixes the problem.
>
>
> Has anyone else encountered on this issue before, and if so, please help
> me. What could be possible solution to this resolution?
>
> Thanks in advance.
>
>
>



-- 
Dmitry Gusev

AnjLab Team
http://anjlab.com

Reply via email to