writing character to db