Updated Database collector to avoid a connection when there is nothing to collect