finish basic function of db connection