Database connection task