Add some error handling and retries when creating a new connection

If connection to DB fails before we hand it off to the application, retry connecting to the DB a few times before failing