Fixing database class connection method