Check connection before reading. Fail if unable to connect

The motivation for this is that, if you set imposm to a long read, you may not be around when it finishes. If somebody starts up imposm with a read and a write, make sure we can at least connect to the DB before beginning the write.

If we can't connect, print the error and quit so the user can either remove the write option or fix his DB parameters.