LP 1768715: Only connect to the database when needed in pingest.pl.