This should work, if it's problem with inactive connection. If OTS restart is every 24h, I would set it to 25h.
IDK what kind of line. Maybe some try { } catch, but IDK what exception to catch. Problem is that MySQL server closes TCP/socket connection for inactivity, but it does not notify OTS...