Reduced code duplication in DatabaseConnection