Added try/catch to the database check.