simplify the code of reading data from databases.