Occasionalmente, la mia applicazione Java/Tomcat6/Debian Squeeze non può comunicare con il server MySql. L'applicazione Tomcat si trova su un server front-end e MySql si trova su una casella separata, MySql. Un errore tipico è:Timeout JDBC MySql anche con 'autoReconnect = true'
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was56588 milliseconds ago.
The last packet sent successfully to the server was 56588 milliseconds ago, which
is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the
server configured values for client timeouts, or using the Connector/J connection property
'autoReconnect=true' to avoid this problem.
Il tempo di timeout indicato è di soli 60 secondi, il che sembra molto breve. Se fosse un'ora o più, avrei semplicemente impostato un'attività in background per eseguire il ping del server DB ogni pochi minuti. Ho aggiunto il parametro autoReconnect all'URL di apertura, senza alcun impatto evidente.
Qualche idea su quale sia il problema? Grazie Pat
vedi questo post http://stackoverflow.com/q/667289/778687 – tusar
@tusar, grazie per il link. Spiega perché ho un sacco di codice da scrivere. Interessante che stiano deprecando la riconnessione automatica. – fishtoprecords
cosa è impostato su wait_timeout sul server? –