working database read/write