Setup and check database connection