How can I keep my DB connection from failing when the network is unstable? How can I keep my DB connection from failing when the network is unstable? oracle oracle

How can I keep my DB connection from failing when the network is unstable?


I suggest the following on Database Component.

  1. do connect on every sql and close on completion.
  2. Use connection timeout & restart query if there is a timeout
  3. If database is disconnected, spool the data to a local database on the client and restart transmission to the central database once there is connectivity again. This way you do not loose any data.
  4. Use a timer to check for central Database connectivity to do spooling of untransmitted data.

This problem is common for shopfloor data collection and the suggestion above is the only way I could effectively handle the problem.


Sorry for the short answer... fix your network. That is really the best option for you at this point.


Try to implement a "watchdog" thread that :

  1. Pings the network (IP address of the database server) every X seconds
  2. If unavailable then disables the UI and try to connect again

Take into account that any transaction might not succeed at all, and save that information somewhere. Then, upon connecting via "watchdog" thread, try to preform that transaction again, if the nature of transaction allows so.