Thread: BUG #17981: HY000 server closed the connection unexpectedly

BUG #17981: HY000 server closed the connection unexpectedly

From
Sayan Oruspay
Date:
I am writing an application on Windows that connects to the local database through psqlodbc. I want to make it automatically detect connection loss and reconnect. When I manually stop the database service and try to send a query, I get an error with sqlstate HY000 and the message ' server closed the connection unexpectedly'. Shouldn't sqlstate be something like 08S01? Also  SQLGetConnectAttr with SQL_ATTR_CONNECTION_DEAD does not produce the right value. The value it returns is always SQL_CD_FALSE.