db implementation