refactoring: Database connection wrappers to eliminate some duplication