implementing database abstraction