Fixed #21597: Validated database connection