abstract out connecting to db