Support external database connections

This PR adds support for external database connections.
This should be just `@_getConnection`.