title: MySql isValid method for timeout
body: <p>Can I use the <code>isValid(0)</code> function to check whether the connection is still active (alive)?</p>
  
  <p>I am getting following exception :</p>
  
  <blockquote>
    <p><strong>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:</strong> </p>
    
    <p>The last packet successfully received from the server was  milliseconds ago.
    The last packet sent successfully to the server was  milliseconds ago, which  is longer than the server configured value of 'wait_timeout'.  </p>
    
    <p>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</p>
  </blockquote>
  
  <p>I can't increase the 'wait_timeout' value.</p>
  
  <p>Also I tried with <code>autoReconnect=true</code> but I need to handle the exception anyway.</p>
  
  <p>I got to know about the <code>isValid()</code> function.
  But I couldn't understand what kind of validity it checks.</p>
  
  <p>Would using <code>isValid(0)</code> help me solve timeout problem?</p>