Installing Impala ODBC Driver in Ubuntu 64 bit

As of now you must know cloudera still do not provide any debian package for Impala ODBC driver so I have downloaded the rpm file for SUSE 11 64bit. Then I have converted it to a debian package file using the below command.

sudo apt-get install alien dpkg-dev debhelper build-essential
 
sudo alien ClouderaImpalaODBC-2.5.26.1027-1.x86_64.rpm
  
Now we will install the driver using the command:-

sudo dpkg -i clouderaimpalaodbc_2.5.26.1027-2_amd64.deb

Configuring ODBC Driver:-

Step 1 :- Edit .bashrc file and make the following entry

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libodbcinst.so
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/odbc
export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc
export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/64/cloudera.impalaodbc.ini
[check out the proper location of odbc.ini file using the command odbcinst -j
use three environment variables—ODBCINI, ODBCSYSINI, and
CLOUDERAIMPALAINI—to specify different locations for the odbc.ini, odbcinst.ini, and
cloudera.impalaodbc.ini configuration files by doing the following:
  • Set ODBCINI to point to your odbc.ini file.
  • Set ODBCSYSINI to point to the directory containing the odbcinst.ini file.
  • Set CLOUDERAIMPALAINI to point to your cloudera.impalaodbc.ini file.
For example, if your odbc.ini and odbcinst.ini files are located in /etc and your
cloudera.impalaodbc.ini file is located in /opt/cloudera/impalaodbc/lib/64, then set the environment variables as follows:
]
Step 2 :- ODBC driver managers use configuration files to define and configure ODBC data sources and
drivers. By default, the following configuration files residing in the user’s home directory are used:
 .odbc.ini is used to define ODBC data sources, and it is required.
 .odbcinst.ini is used to define ODBC drivers, and it is optional.

Also, by default the Cloudera ODBC Driver for Impala is configured using the
cloudera.impalaodbc.ini file, which is located in

 /opt/cloudera/impalaodbc/lib/64 for the 64-bit driver on Linux/AIX

Step 3 :- Configuring the odbc.ini File
ODBC Data Source Names (DSNs) are defined in the odbc.ini configuration file. The file is divided
into several sections:
 [ODBC] is optional and used to control global ODBC configuration, such as ODBC tracing.
 [ODBC Data Sources] is required, listing DSNs and associating DSNs with a driver.
 A section having the same name as the data source specified in the [ODBC Data Sources] section
is required to configure the data source.
The following is an example of an odbc.ini configuration file for Linux/AIX:

[ODBC Data Sources]
Sample_Cloudera_Impala_DSN_64=Cloudera Impala ODBC Driver 64-bit
[Sample_Cloudera_Impala_DSN_64]
Driver=/opt/cloudera/impalaodbc/lib/64/libclouderaimpalaodbc64.so
HOST=localhost
PORT=21050


To create a Data Source Name:
1. Open the .odbc.ini configuration file in a text editor.
2. In the [ODBC Data Sources] section, add a new entry by typing the Data Source Name (DSN),
then an equal sign (=), and then the driver name.
3. In the .odbc.ini file, add a new section with a name that matches the DSN you specified in
step 2, and then add configuration options to the section. Specify configuration options as
key-value pairs.
4. Save the .odbc.ini configuration file.

Step 4 :- Configuring the odbcinst.ini File
ODBC drivers are defined in the odbcinst.ini configuration file. The configuration file is optional
because drivers can be specified directly in the odbc.ini configuration file.
The odbcinst.ini file is divided into the following sections:
 [ODBC Drivers] lists the names of all the installed ODBC drivers.
 A section having the same name as the driver name specified in the [ODBC Drivers] section
lists driver attributes and values.
The following is an example of an odbcinst.ini configuration file for Linux/AIX:

[ODBC Drivers]

Cloudera Impala ODBC Driver 64-bit=Installed
[Cloudera Impala ODBC Driver 64-bit]
Description=Cloudera Impala ODBC Driver (64-bit)
Driver=/opt/cloudera/impalaodbc/lib/64/libclouderaimpalaodbc64.so

To define a driver:
1. Open the .odbcinst.ini configuration file in a text editor.
2. In the [ODBC Drivers] section, add a new entry by typing the driver name and then typing
=Installed
3. In the .odbcinst.ini file, add a new section with a name that matches the driver name you
typed in step 2, and then add configuration options to the section based on the sample
odbcinst.ini file provided in the Setup directory. Specify configuration options as key-value
pairs.
4. Save the .odbcinst.ini configuration file.

Step 5 :- Configuring the cloudera.impalaodbc.ini File
The cloudera.impalaodbc.ini file contains configuration settings for the Cloudera ODBC Driver for
Impala. Settings that you define in the cloudera.impalaodbc.ini file apply to all connections that use the driver.

To configure the Cloudera ODBC Driver for Impala to work with your ODBC driver manager:
1. Open the cloudera.impalaodbc.ini configuration file in a text editor.
2. Edit the DriverManagerEncoding setting. The value is usually UTF-16 or UTF-32 if you are
using Linux/Mac OS X, depending on the ODBC driver manager you use. iODBC uses UTF-
32, and unixODBC uses UTF-16.
OR
If you are using AIX and the unixODBC driver manager, then set the value to UTF-16. If you
are using AIX and the iODBC driver manager, then set the value to UTF-16 for the 32-bit
driver or UTF-32 for the 64-bit driver.
3. Edit the ODBCInstLib setting. The value is the name of the ODBCInst shared library for the
ODBC driver manager you use. To determine the correct library to specify, refer to your
ODBC driver manager documentation.
The configuration file defaults to the shared library for iODBC. In Linux/AIX, the shared
library name for iODBC is libiodbcinst.so.
4. Optionally, configure logging by editing the LogLevel and LogPath settings. For more
information, see "Configuring Logging Options" on page 28.
5. Save the cloudera.impalaodbc.ini configuration file.

Step 6 :- Check the entry and configuration of ODBC by typing

odbcinst  -q -s
   
 isql -v Sample_Cloudera_Impala_DSN_64
 
Trouble Shooting :-
 
Well I have got one error like 
[S1000][unixODBC][Cloudera][ODBC] (11560) Unable to locate SQLGetPrivateProfileString function.
 
which means that the driver is not linked to libodbcinst.so
Please check it first with the command
ldd /opt/cloudera/impalaodbc/lib/64/libclouderaimpalaodbc64.so
  
then search for libodbcinst.so
 
find / -name "libodbcinst.so*" 
If not found then install it 

sudo apt-get update && sudo apt-get install unixodbc-dev libmyodbc
or
 
sudo apt-get install unixODBC unixODBC-dev
 
Then again try to search for libodbcinst.so
 
and make entry in .bashrc as
 
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libodbcinst.so
 
For more info click here and here and here and here. 

11 comments:

  1. As you suggested I configured & tried to connect but its shown "Unable to locate SQLGetPrivateProfileString" error message.

    $ isql -v parq_prototype
    [S1000][unixODBC][Cloudera][ODBC] (11560) Unable to locate SQLGetPrivateProfileString function.
    [ISQL]ERROR: Could not SQLConnect


    But I add libodbcinst.so file in /etc/bash.bashrc file. Still its showing that error.

    bash.bashrc
    export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libodbcinst.so
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/odbc
    export ODBCINI=/etc/odbc.ini
    export ODBCSYSINI=/etc
    export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/64/cloudera.impalaodbc.ini

    ReplyDelete
  2. It was really a nice post and i was really impressed by reading this Big Data Hadoop Online Training Hyderabad

    ReplyDelete
  3. "Excellent material! Your post expertly demonstrates your knowledge and commitment. Our professional community values and highly appreciates your insights. I look forward to your future insightful contributions. Splunk Training


    ReplyDelete
  4. Amazing post! Your originality and wisdom are evident. We appreciate you giving us your insightful perspective. Stay motivating! Splunk Certification

    ReplyDelete
  5. "Your post shows that you have a thorough understanding of the topic. Your opinions are well-informed and significantly advance worthwhile debates. Kudos! DevOps Training

    ReplyDelete
  6. "Your commitment and contagious optimism truly shine, strengthening our team. I appreciate your significant contributions. DevOps Certification

    ReplyDelete
  7. "Your post demonstrates a thorough comprehension of the subject. Your insightful comments add to the conversation and present new angles. Within our professional community, we sincerely appreciate the efforts you have made. I'm grateful. Blue Prism Certification

    ReplyDelete
  8. It is a magnificent work of art! It enthrals with its perceptive writing, flawless research, and writing style. I appreciate you sharing your insightful viewpoint. Outstanding effort! Blue Prism Course

    ReplyDelete
  9. Your essay is a stunning piece of writing! It captivates readers with its insightful writing, impeccable research, and writing style. Thank you for sharing your wise perspective. A superb work!  Ruby On Rails Certification

    ReplyDelete
  10. The caliber and depth of your most recent post have truly astonished me. Your knowledge is evident in every sentence, and our professional community has benefited much from your views. It's impressive how you can simplify difficult ideas into facts that everybody can understand. Salesforce Admin Certification

    ReplyDelete