docs: private ConnectionResults getConnection(final String userName, final String password,
                                              final Subject subject, final WSConnectionRequestInfoImpl cri, boolean useKerb,
                                              final Object credential)
                      throws ResourceException {
          final boolean trace = TraceComponent.isAnyTracingEnabled();
          if (trace && tc.isEntryEnabled())
              Tr.entry(this, tc, "getConnection",
                       userName, subject == null ? null : "subject", AdapterUtil.toString(cri),
                       useKerb, credential);
  
          ConnectionResults results;
          Connection conn;
  
          // Some JDBC drivers support propagation of GSS credential for kerberos via Subject.doAs
          if (useKerb && helper.supportsSubjectDoAsForKerberos())
              try {
                  // Run this method as the subject.
  
                  final PrivilegedExceptionAction<ConnectionResults> getConnection =
                                  new PrivilegedExceptionAction<ConnectionResults>()
                                  {
                                      public ConnectionResults run() throws ResourceException
                                      {
                                          return getConnection(userName, password, subject, cri, false, credential);
                                      }
                                  };
  
                  results = (ConnectionResults) AccessController.doPrivileged(
                                  new PrivilegedExceptionAction<ConnectionResults>()
                                  {
                                      public ConnectionResults run() throws Exception
                                      {
                                          // Work around a bug in JGSS where they add the kerberos ticket to the
                                          // private credentials, which prevents the subject from matching
                                          // connection requests and causes pooled connection to never be reused.
                                          // The work around is to copy the subject, so that the original isn't
                                          // modified.
                                          Subject copy = new Subject(subject.isReadOnly(),
                                                          subject.getPrincipals(),
                                                          subject.getPublicCredentials(),
                                                          subject.getPrivateCredentials());
                                          if (trace && tc.isDebugEnabled())
                                              Tr.debug(this, tc, "running as subject", copy);
                                          return Subject.doAs(copy, getConnection);
                                      }
                                  });
              } catch (PrivilegedActionException privX) {
                  Throwable x = privX.getCause();
                  if (x instanceof PrivilegedActionException)
                      x = x.getCause();
                  FFDCFilter.processException(x, getClass().getName(), "1734", this);
                  if (trace && tc.isEntryEnabled())
                      Tr.exit(this, tc, "getConnection", x);
  
                  if (x instanceof ResourceException)
                      throw (ResourceException) x;
                  else
                      // shouldn't ever happen
                      throw new DataStoreAdapterException("GENERAL_EXCEPTION", null, getClass(), x.getMessage());
              }
          else if (DataSource.class.equals(type))
          {
              if (trace && tc.isDebugEnabled())
                  Tr.debug(this, tc, "Getting a connection using Datasource. Is UCP? " + isUCP);
              conn = getConnectionUsingDS(userName, password, cri);
              results = new ConnectionResults(null, conn);
          } else if (Driver.class.equals(type)) {
              if (trace && tc.isDebugEnabled())
                  Tr.debug(this, tc, "Getting a connection using Driver");
              conn = getConnectionUsingDriver(userName, password);
              results = new ConnectionResults(null, conn);
          } else {
              try {
                  results = helper.getPooledConnection((CommonDataSource) dataSourceOrDriver, userName, password, XADataSource.class.equals(type), cri, useKerb, credential);
              } catch (DataStoreAdapterException dae) {
                  throw (ResourceException) AdapterUtil.mapException(dae, null, this, false); // error can't be fired as we don't have an mc
              }
              results.connection = getConnection(results.pooledConnection, cri, userName);
          }
  
          if (trace && tc.isEntryEnabled())
              Tr.exit(this, tc, "getConnection", results);
          return results;
      }