add database connection & some functions