finish the two method of database