Adding ConnectWithTimeouts to db.

Hello @ktzhu, @majelbstoat, @dpup, 

Please review the following commits I made in branch 'andrew-timeout'.



R=@ktzhu
R=@majelbstoat
R=@dpup