add ConnectionFactory and apply this code