refactor dbconnection to oo