reading and writing from DB