max active connections and idle timeout

- set a maximum number of active connections and idle timeout
- now masks error if cannot connect to the db