Added code to check if the database is active.