Throw an exception if the database connection cannot be established (see #4071)