title: Check if pyodbc connection is open or closed
body: <p>I often get this error: <code>ProgrammingError: The cursor's connection has been closed.</code> </p>
  
  <p>Is there a way to check whether the connection I am using has been closed before I attempt to execute a query?</p>
  
  <p>I'm thinking of writing a wrapper to execute queries. First it would check whether the connection is closed, if it is, it would reconnect. Is this an advisable way of doing this?</p>