pc.setManagedConnectionFactory(mcfs[i]);
Principal prin =
new ResourcePrincipal(dbUser, dbPassword);
subject.getPrincipals().add(prin);
subject.getPrivateCredentials().add(pc);
ManagedConnection mc = mcfs[i].
createManagedConnection(subject, null);
connList.addElement(mc);
try {
XAResource xares = mc.getXAResource();
if (xares != null) {
xaresList.addElement(xares);
}
} catch (ResourceException ex) {
// ignored. Not at XA_TRANSACTION level
}
}
} else {
ManagedConnectionFactory mcf =
crt.obtainManagedConnectionFactory(poolName);
PasswordCredential pc = new PasswordCredential(
dbUser, dbPassword.toCharArray());
pc.setManagedConnectionFactory(mcf);
Principal prin = new ResourcePrincipal(dbUser, dbPassword);
subject.getPrincipals().add(prin);
subject.getPrivateCredentials().add(pc);
ManagedConnection mc = mcf.createManagedConnection(subject, null);
connList.addElement(mc);
try {
XAResource xares = mc.getXAResource();
if (xares != null) {
xaresList.addElement(xares);
}
} catch (ResourceException ex) {
// ignored. Not at XA_TRANSACTION level