TST: skip sql tests if connection to server fails

Further work on #6292, non-controversial part of #6627.