Factorymehtode for Connection