Getting DB connection before making query.