auto reconnect to the database