Connection to and running queries on remote in main.