updated db connection method