Add checkConnected() calls to re-establish dead SQL connections

Note that this will not help the people who are losing data due to a crashed SQL server, but it fixes the all-too-common case of the localhost connection dropping because it wasn't used for 10 hours.