title: How can I detect that a TadoConnection lost the communication with the server?
body: <p>I need to detect when a <a href="http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ADODB_TADOConnection.html" rel="noreferrer">TAdoConnection</a> component has lost the connection with the server. I've tried using the <a href="http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/ADODB_TADOConnection_OnDisconnect.html" rel="noreferrer">OnDisconnect</a> event but this only fires when the Close method is called or the Connected property is set to false.</p>
  
  <p>Another option I've tried is using a <a href="http://docwiki.embarcadero.com/VCL/en/ExtCtrls.TTimer" rel="noreferrer">TTimer</a> and executing a query like this</p>
  
  <pre><code>SELECT 1 RESULT FROM DUAL
  </code></pre>
  
  <p>in the OnTimer event, catching any exception that occurs.</p>
  
  <p>Is there a better option to detect that the connection was lost?</p>