Class<?> driverClazz = ClassLoaderUtils.loadClass(driverClassName);
Driver driver = (Driver) driverClazz.newInstance();
Properties props = new Properties();
if (user != null) props.setProperty("user", user);
if (password != null) props.setProperty("password", password);
Connection connection = driver.connect(url, props);
XAConnection xaConnection = JdbcProxyFactory.INSTANCE.getProxyXaConnection(connection);
return xaConnection;
} catch (Exception ex) {
throw (SQLException) new SQLException("unable to connect to non-XA resource " + driverClassName).initCause(ex);
}