Example - Using Command Blocks for Proxy Connections

If you are using proxy connections, you can use an existing idle connection with signons for proxy connections.

The physical connection can be used by more than one user. Because the proxy connections run on top of the existing physical connection, fewer physical connections are required.

To create a proxy connection, you create open session command blocks in XML.

The following is a simple example of an open session command block that creates a proxy connection for User1 (Oracle) or switches to User1 (DB2®). Note that the sessionStartCommand can only be used with Oracle and DB2.

<commandBlock>
  <commands>
    <sessionStartCommand>
      <arguments>
        <argument>
          <name>OCI_ATTR_USERNAME</name>
          <value>PROXY_USER1</value>
        </argument>
      </arguments>
    </sessionStartCommand>
  </commands>
</commandBlock>

Another example is a macro that can be substituted if authentication userNames are equivalent to the proxy userid or trusted context user.

<commandBlock>
  <commands>
    <sessionStartCommand>
      <arguments> 
        <argument> 
          <name>OCI_ATTR_USERNAME</name>
          <value>#$account.personalInfo.userName#
          </value>
        </argument>
      </arguments>
    </sessionStartCommand>
  </commands>
</commandBlock>

The following is a simple example of a close session command block for a proxy session. The current proxy connection is terminated. Note that sessionEndCommand ends an OCI_session in Oracle and switches the user back to the trusted context owner for DB2.

<commandBlock>
  <commands>
    <sessionEndCommand>
      <arguments/>
    </sessionEndCommand>
  </commands>
</commandBlock>