We have a very data centric application, which is often run across networks with questionable connectivity.
We want to feedback to clients when the database is offline, and display some kind of warning screen – with error information – until the network comes back and the database is available again. I’d like to display the same screen whenever the database is unavailable for any reason – ie: service stopped, paused, login failure, network off, etc.
I have a routine handling SQLClient.SQLException, which I then parse for SQLErrors and check the numbers, problem is there are loads of different error numbers for failures and I keep missing some.
Is there some simple, consistent way i can check if the database server is offline or unavailable? How do others handle this without letting some unhandled exception slip through?
Cheers
you can easily catch only sql exceptions like this: