write datums to db