createConnection method