Preparing the federated server to access data sources through ODBC (Linux®, UNIX)

On federated servers that run Linux or UNIX, there are two methods to access ODBC data source, namely DSN connection mode and DSN-less connection mode. For DSN connection mode, to prepare the federated server, you must verify the settings in the odbc.ini file, and test the connection to ODBC data sources. For DSN-less connection mode, you can configure the driver path by specifying the "DRIVER=" keyword in a file named odbcinst.ini. The file odbcinst.ini must exist when an ODBC wrapper works, and this is already set by default for type 2 data sources.

Before you begin

You must set the DriverUnicodeType parameter to 1 in the odbc.ini configuration file of the DSN when you use the ODBC wrapper to connect to SAP HANA data source.
DriverUnicodeType =1

Procedure

  1. Verify that the odbc.ini(for DSN mode) and odbcinst.ini (for DSN-less mode, configured by default for type 1 data sources) files have been updated on the federated server. If the files do not exist, you can create them in a text editor. Consult the documentation from the ODBC client vendor for information about the odbc.ini and odbcinst.ini files.
  2. Configure the ODBC driver by placing the driver file libcodbcxxx.so to this directory:
    $INSTANCE_HOME/sqllib/federation/odbc/lib/
  3. Configure odbc.ini file in DSN connection mode:
    • Add the odbc.ini file location into db2dj.ini. For example:
      ODBCINI=$INSTANCE_HOME/odbc.ini
    • The default driver directory is
      $INSTANCE_HOME/sqllib/federation/odbc/lib/ 
    • About the parameters in odbc.ini, please refer to Data Direct official website.
    Take data source SAP HANA for example, odbc.ini file like this, “hanatest” is the node name when you execute create server command.
    [ODBC]
    InstallDir=/home/db2inst1/sqllib/federation/odbc
    
    [hanatest]
    Driver=/home/db2inst1/sqllib/federation/odbc/lib/libodbcHDB.so
    DriverUnicodeType=1
    ServerNode=x.x.x.x:39013

What to do next

After you complete this task, you can register the wrapper.