Adding a client affinity list to the db2dsdriver.cfg file for hostname validation

A client affinity lists allows a client to fail-over to one or more alternate servers in the given order.

When connecting to one of these alternate servers, hostname validation is successful if the server certificate matches one of the following:
  • The primary hostname to which the client is configured to connect
  • The hostname of an alternate server specified by the alternateserverlist parameter
For example, the following db2dsdriver.cfg file is configured so that the client's attempts to connect are targeted at pqr.db2.example.com, abc.db2.example.com, and then xyz.db2.example.com in sequence until a connection is established. For hostname validation to be successful for any of these connections, the server’s certificate must match either xyz.db2.example.com or the hostname of the alternate server to which the client is attempting to connect.
<configuration>
  <dsncollection>
    <dsn alias="test" name="testdb" host="xyz.db2.example.com" port="1234"/>
  </dsncollection>
<databases>

  <database name="testdb" host="xyz.db2.example.com" port="1234">

     <acr>

       <parameter name="enableAcr" value="true"/>
       <parameter name="maxAcrRetries" value="1"/>
       <parameter name="acrRetryInterval" value="2"/>

       <alternateserverlist>
         <server name="server1" hostname="xyz.db2.example.com" port="1234">
         </server>
         <server name="server2" hostname="abc.db2.example.com" port="1234">
         </server>
         <server name="server3" hostname="pqr.db2.example.com" port="1234">
         </server>
       </alternateserverlist>

       <affinitylist>
         <list name="list1" serverorder="server3,server2,server1">
         </list>
       </affinitylist>

       <clientaffinitydefined>
         <client name="client1" hostname="client.example.com" listname="list1">
         </client>
       </clientaffinitydefined>

     </acr>

  </database>
</databases>
</configuration>