Check the status of the db connection first before trying
to dereference it.
Check the status of the database connection before using it.