Connecting to an external database