Marco,

I had the same problem and I think I've tracked down what I did (I didn't
document my solution properly) to fix it.  Before I mention that, I would
like to point out that I recall an issue with the MySQL connection drivers
where autoCommit and autoReconnect wouldn't play together well and that was
key to the problem.  I believe this was my final, simple solution:

Stop using C3P0, the default connection provider and switch to a provider
which can validate a connection object BEFORE it passes it to your
application.  You can do this in DBCP or Proxool with MySQL.

A. For DBCP, http://jakarta.apache.org/commons/dbcp, set the properties:
dbcp.validationQuery=select CURRENT_DATE
dbcp.testOnBorrow=true (Default, I think)

For more info, see:
http://jakarta.apache.org/commons/dbcp/configuration.html

2. For Proxool, http://proxool.sourceforge.net, set the properties:
proxool.house-keeping-test-sql=select CURRENT_DATE
proxool.test-before-use=true

For more info, see:
http://proxool.sourceforge.net/properties.html

Regards,
David

-----Original Message-----
From: Jan Behrens [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 31, 2004 5:22 AM
To: 'Struts Users Mailing List'
Subject: RE: OT/ Tomcat, Hibernate and MYSQL problem


Hello Marco,

not sure if that helps but I have found the MySql java list quite helpfull
when talking about things like this - especially when it comes to the
driver, as Mark Matthews (author of the driver) post frequently to that
list. URL: http://lists.mysql.com/java.

Ignore my if you knew that allready ;)

Cheers, Jan

> -----Original Message-----
> From: Marco Mistroni [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 30, 2004 12:24 PM
> To: 'Struts Users Mailing List'
> Subject: RE: OT/ Tomcat, Hibernate and MYSQL problem
>
>
> Hello,
>
> >Marco, please tell us what winds up happening with your app. I'm now
> >very curious.
>
>
> Well, I m using, as I said,  mysql connector 3.0.11, with
> mysql 4.1 alpha & hibernate together. My app is running on tomcat 5.0
>
> I m using hibernate 2.1. I haven't configured any connection pools on
> Tomcat, but I m using hibernate built it connection pool.
> I m leaving my app running all the time, couple of days ago I
> noticed that When I tried to connect to it from work, I got
> exception.
> After, I went home, checked what was wrong (something I found
> out already Couple of months ago, without using hibernate,
> but when I was still using Mysql).. I don't remember exactly
> where, but I found out htat usually after 9 hrs The
> connection to mysql drops (dunno if only with tomcat, or with
> something else). So, I tried this <property
> name="connection.autoReconnect">true</property>
> <property name="connection.autoReconnectForPools">true</property>
> <property
> name="connection.is-connection-validation-required">true</property>
>
> still didn't work
>
> so I tried to add autoReconnect=true to JDBC URL and run
> following tests
> - connecting after 1 hour being idle - everything ok
> - connecting after 3 hours being idle - everything ok
> - connecting after 7 hrs being idle - everything ok.
>
> I thought I have solved the problem, but between today and
> yesterday, I left App running after 13 hours being idle....
> and problem appeared again.
>
> And that's when I posted the problem......
>
> Thanx 4 any feedback
>
> Regards
>       marco
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to