Once my app starts I will try to connect and I get err if connection is not established, which is great.
I keep persistent connection in my Node.js app and I struggle how to handle when connection is terminated later, when sql server is restarted or something. I get errors from Thank you. |
Unlike ADO.NET, there are no properties associated with the connection (i.e., there is no conn.State to test). In this case, a liveness test can be implemented by executing a "SELECT 1" which will always succeed if a connection is present and fail when it isn't. But then you didn't want to use exec. |
There is a similar question, but for a different API and different server: http://sqlanywhere-forum.sap.com/questions/23217/sybaseiq-c-check-if-connected Maybe this is what you need!