Question & Answer
Question
How to query Apache Hive 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. Make sure the required ODBC drivers are installed correctly.
$ ls sqllib/federation/odbc/lib/FOhive*.so
2. Make sure the data source is accessible to Federation server.
$ telnet test1.ibm.com 10000
Trying 9.30.231.148...
Connected to test1.ibm.com.
Escape character is '^]'.
3. Create server, user mapping, nickname and query the nickname.
$ create server SERVER1 type hive version 6.0 OPTIONS(host 'test1.ibm.com', port '10000', dbname 'default')
$ create user mapping for user server SERVER1 options(REMOTE_AUTHID 'hive',REMOTE_PASSWORD 'hadoop')
$ create nickname n1 for server1."test_ts"
$ select * from n1
[{"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)"}]
Was this topic helpful?
Document Information
Modified date:
08 March 2022
UID
ibm16431135