You can remedy this problem with MySQL by adding autoReconnect=true in your
JDBC URL.  For instance:

jdbc:mysql://localhost/mydatabase?autoReconnect=true

I've also heard that adding a validationQuery parameter will have a similar
effect (at least with Oracle):

        <parameter>
            <name>validationQuery</name>
            <value>SELECT 1 FROM DUAL</value>
        </parameter>

I'm having a similar problem with Oracle - I wonder if anyone else has seen
this.  When using Tomcat's connection pool (DBCP) and Oracle - everything
works great for about two hours - and then Oracle seems to close the
connection.  I don't know if this is Hibernate related or what, but I'm
using a JNDI connection and there's no timeout set on the Oracle user.  No
one is using the system right now, so I'm guessing the connection is being
closed either by Tomcat or by Hibernate.

Thanks,

Matt

> -----Original Message-----
> From: Enrico Donelli [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 30, 2003 2:18 AM
> To: [EMAIL PROTECTED]
> Subject: [Hibernate] "Communication link failure: java.io.IOException"
> 
> 
> Hi everybody,
> I'm a newbye in using hibernate, so I beg you pardon in the 
> question is 
> dummy :).
> I'm using tomcat4 with mysql, and, of course, hibernate. I open and 
> close the hibernate session with a filter, using a modified 
> version of 
> the filter published on the mailing list a couple of weeks ago. 
> Everything seems fine, i've also made some stress tests with 
> jmeter and 
> my application serves 50 clients simultaneous with no problem. What 
> happens is that after a certain number of hours of no-use of the 
> application I get a "Communication link failure: 
> java.io.IOException": I 
> think that mysql closes the connection, but I don't know how to tell 
> hibernate to reopen the connession if closed.
> Which is the best way to solve this problem.
> 
> Thanks in advance!
> 
> Enrico
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> hibernate-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/hibernate-devel
> 



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to