Test connection to DB and time a query