ConnectionFactory and Exception refactoring.