move common code to lib.scm

dbconn, with-db