Clear the database connection and reconnect if we have a non-zero error code.