added some simple code for database reading and writing.