Read and write urls to the database