moving db selection into db.connect, where it should be