DB: ping MySQL before opening a cursor

Pinging the database with the "reconnect" option turned on should
cause it to reconnect in the event of the connection having
timed out.