Thanks Thomas,


I tried Michael Schulze advise and found I needed to upgrade to the
MySQL Connector/J version 3.0.7 to use the autoReconnect parameter for
the db URL.  This didn't solve my problem though.  I then found the
README file for Connector/J explicitly says:-

 " MySQL closes connections after 8 hours of inactivity. You either
  need to use a connection pool that handles stale connections or use
the 
  "autoReconnect" parameter (see "USAGE AND INSTALLATION"). Also, you
should
  be catching SQLExceptions in your application and dealing with them,
rather
  than propagating them all the way until your application exits, this
is just
  good software development. MySQL Connector/J will set the SQLState
(see 
  java.sql.SQLException.getSQLState() in your APIDOCS) to "08S01" when
it 
  encounters network-connectivity issues during the processing of a
query. 
  Your application code should then attempt to re-connect to MySQL at
this 
  point. "

I presume I should be expecting OJB to take care of this for me. I don't
find the validationQuery attribute in the repository.dtd for the
connection-pool element so is this an enhancement in a more recent
version of OJB?

TIA
Paul W.

-----Original Message-----
From: Mahler Thomas [mailto:[EMAIL PROTECTED] 
Sent: 04 June 2003 09:07
To: 'OJB Users List'
Subject: RE: timeout after long period of idleness


It's a problem of the connection pool. It keeps the connections, but
after some time MySql disconnects the idle connections. You should use
the connection-pool validationQuery attribute to specify a SQL query
that is used to detect if a connection is still alive, as in the
following example

<connection-pool maxActive="5" whenExhaustedAction="0"
validationQuery="select count(*) from OJB_HL_SEQ" />


cheers,
thomas

> -----Original Message-----
> From: Paul Worrall [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 04, 2003 9:59 AM
> To: [EMAIL PROTECTED]
> Subject: timeout after long period of idleness
> 
> 
> Hi,
>  
> I am using ojb-0.9.5 for persistence in a servlet application running 
> under Tomcat 4.1.12 on Java 1.4.0_1.  The database is MySQL and I used

> 3.23.51 without any problems but a recent upgrade to 4.0.12 has 
> introduced a problem where OJB seems to loose its connections/ability 
> to connect after a long period of idleness.  Long period is
> between 5 to 8
> hours.
>  
> Has anyone experience this problem?
> 
> Kind regards,
> 
> 
> Paul Worrall
> Architect | Director
> 
> Apcentric Limited
> 
> The Soft Science of J2EE Deployment
> 
> 
> m: +44 (0) 77 1133 0213
> w: www.apcentric.com <http://www.apcentric.com/> 
> 
> Any opinions expressed in the email are those of the
> individual and not 
> necessarily of the company.  This email and any files 
> transmitted with 
> it are confidential and solely for the use of the intended recipient. 
> It may contain material protected by attorney-client 
> privilege.  If you 
> are not the intended recipient or person responsible for 
> delivering to 
> the intended recipient, be advised that you have received 
> this email in 
> error and that any use is strictly prohibited.  If you have received 
> this email in error please notify the IT manager. 
> 
>  
> 


---------------------------------------------------------------------
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