UNIX: Create Region and Cross-Region Data Sources for Db2

Attention: This feature is in Early Adopter Product (EAP) release status. We will continue the development of additional features and provide additional interfaces via patch updates and future releases. Please contact Micro Focus SupportLine if you require further clarification.
Note: We recommend that you use a connection string to connect to Db2 databases; that is, using the connect attribute within MFDBFH.cfg, which is covered in a later step (Update the Configuration File for DB2 Region and Cross-Region Databases).

Use the following steps if you do not intend to use connection strings, but instead create ODBC data sources to access region and cross-region databases.

There are a number of different driver managers that you can use to configure an ODBC data source. These instructions are carried out using unixODBC. If you are using a different driver manager, consult the vendor instructions for creating data sources.

  1. Run the command odbcinst -j command, and note down the location of the drivers configuration file (odbcinst.ini) and the user data sources configuration file (.odbc.ini).
  2. Open the odbcinst.ini configuration file and ensure that you have something similar to the following:

    (This may differ depending on the version of Db2 you are running.)

    [Db2]
    Description=Sample DB2 ODBC Database
    Driver=/opt/ibm/db2/dsdriver/lib/libdb20.so
  3. Open the .odbc.ini configuration file and add an entry for a region database data source:
    [<datasource-name>]
    Driver = <driver-name>
    Server = <server-name>
    Port = <port-no>
    Database = <region-name>
    where:
    • <datasource-name> - a name for the data source.
    • <driver-name> - the name of the driver as configured in the .odbc.ini file; in the example above, that would be DB2.
    • <server-name> - the name of the server on which the database instance resides.
    • <port-no> - the port on which the database is listening.
    • <region-name> - the name of a region database (which matches the name of an enterprise server region).
  4. Repeat the last step for each additional region database that you have.
  5. Add a new data source entry for a cross-region database:
    [<datasource-name>]
    Driver = <driver-name>
    Server = <server-name>
    Port = <port-no>
    Database = $XREGN$
  6. Save the .odbc.ini configuration file.

Example .odbc.ini file

The following is an example of an .odbc.ini configuration file contains data sources for a local Db2 database instance with two datastores.

[DB2.ESDEMO]
Driver = DB2
Server = localhost
Port = 50000
Database = ESDEMO

[DB2.XREG]
Driver = DB2
Server = localhost
Port = 50000
Database = $XREGN$
The data sources for a region and a cross-region database are configured. Next, you need to update the configuration file (MFDBFH.cfg) to use the data sources: see Update the Configuration File for Db2 Region and Cross-Region Databases.