IBM Support

How to query SAP Hana using Db2 Federation through ODBC driver?

Question & Answer


Question

How to query SAP Hana using Db2 Federation through ODBC driver?

Answer

Before You Begin
 
Enable Federation feature and restart Db2 to make it effective.
$ db2 update dbm cfg using federated YES
Pre-Configuration on Linux, Unix
 
1. You need to download the SAP Hana ODBC driver from SAP official site. Put it in the path ~/sqllib/federation/odbc/lib.
ls ~/sqllib/federation/odbc/lib/libodbcHDB.so
 
2. Make sure the data source is accessible to Federation server.
$ telnet munch1.fyre.ibm.com 39017
Trying 9.30.100.76...
Connected to munch1.fyre.ibm.com.
Escape character is '^]'.
 
3. Create server, user mapping,  nickname and query the nickname.
$ CREATE SERVER SERVER1 type hana version 2.0 OPTIONS(HOST 'munch1.fyre.ibm.com',PORT '39017',DBNAME 'systemdb',CODEPAGE '1252')

$ CREATE USER MAPPING FOR PUBLIC SERVER SERVER1 OPTIONS( REMOTE_PASSWORD 'SAPhxe123',REMOTE_AUTHID 'system' )

$ CREATE NICKNAME N1 FOR SERVER1.TEST_HANA1

$ select count(*) from n1

1
-----------
          9

  1 record(s) selected.

[{"Line of Business":{"code":"","label":""},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSCAVPX","label":"Federated Server"},"ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

Modified date:
06 May 2021

UID

ibm16431129