Skip to content

Instantly share code, notes, and snippets.

@mrmichalis
Created October 4, 2013 12:35
Show Gist options
  • Save mrmichalis/6825250 to your computer and use it in GitHub Desktop.
Save mrmichalis/6825250 to your computer and use it in GitHub Desktop.
CDH ODBC Hive configuration
[Driver]
## - Note that this default DriverManagerEncoding of UTF-32 is for iODBC.
## - unixODBC uses UTF-16 by default.
## - If unixODBC was compiled with -DSQL_WCHART_CONVERT, then UTF-32 is the correct value.
## Execute 'odbc_config --cflags' to determine if you need UTF-32 or UTF-16 on unixODBC
## - SimbaDM can be used with UTF-8 or UTF-16.
## The DriverUnicodeEncoding setting will cause SimbaDM to run in UTF-8 when set to 2 or UTF-16 when set to 1.
DriverManagerEncoding=UTF-32
ErrorMessagesPath=/opt/cloudera/hiveodbc/ErrorMessages/
LogLevel=0
LogPath=
## - Uncomment the ODBCInstLib corresponding to the Driver Manager being used.
## - Note that the path to your ODBC Driver Manager must be specified in LD_LIBRARY_PATH (LIBPATH for AIX).
## - Note that AIX has a different format for specifying its shared libraries.
# Generic ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.so
# SimbaDM / unixODBC
ODBCInstLib=/usr/lib64/libodbcinst.so
# AIX specific ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.a(libiodbcinst.so.2)
# SimbaDM
#ODBCInstLib=libodbcinst.a(odbcinst.so)
# unixODBC
#ODBCInstLib=libodbcinst.a(libodbcinst.so.1)
[ODBC]
# Specify any global ODBC configuration here such as ODBC tracing.
[ODBC Data Sources]
Hive32=Cloudera ODBC Driver for Apache Hive 32-bit
Hive64=Cloudera ODBC Driver for Apache Hive 64-bit
[Hive32]
# Description: DSN Description.
# This key is not necessary and is only to give a description of the data source.
Description=Cloudera ODBC Driver for Apache Hive (32-bit) DSN
# Driver: The location where the ODBC driver is installed to.
Driver=/opt/cloudera/hiveodbc/lib/32/libclouderahiveodbc32.so
# The DriverUnicodeEncoding setting is only used for SimbaDM
# When set to 1, SimbaDM runs in UTF-16 mode.
# When set to 2, SimbaDM runs in UTF-8 mode.
#DriverUnicodeEncoding=2
# Values for HOST, PORT, HS2HostFQDN, and HS2KrbServiceName should be set here.
# They can also be specified on the connection string.
HOST=[HOST]
PORT=[PORT]
Schema=default
FastSQLPrepare=0
UseNativeQuery=0
HiveServerType=2
HS2AuthMech=2
HS2HostFQDN=[Hive Server 2 Host FQDN]
HS2KrbServiceName=[Hive Server 2 SASL service name]
UserName=[User on Host running Hive Server 2]
[Hive64]
# Description: DSN Description.
# This key is not necessary and is only to give a description of the data source.
Description=Cloudera ODBC Driver for Apache Hive (64-bit) DSN
# Driver: The location where the ODBC driver is installed to.
Driver=/opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so
# The DriverUnicodeEncoding setting is only used for SimbaDM
# When set to 1, SimbaDM runs in UTF-16 mode.
# When set to 2, SimbaDM runs in UTF-8 mode.
#DriverUnicodeEncoding=2
# Values for HOST, PORT, HS2HostFQDN, and HS2KrbServiceName should be set here.
# They can also be specified on the connection string.
HOST=192-168-1-112
PORT=10000
Schema=default
FastSQLPrepare=0
UseNativeQuery=0
HiveServerType=2
HS2AuthMech=2
HS2HostFQDN=192-168-1-112
#HS2KrbServiceName=[Hive Server 2 SASL service name]
UserName=hdfs
[ODBC Drivers]
Cloudera ODBC Driver for Apache Hive 32-bit=Installed
Cloudera ODBC Driver for Apache Hive 64-bit=Installed
[Cloudera ODBC Driver for Apache Hive 32-bit]
Description=Cloudera ODBC Driver for Apache Hive (32-bit)
Driver=/opt/cloudera/hiveodbc/lib/32/libclouderahiveodbc32.so
[Cloudera ODBC Driver for Apache Hive 64-bit]
Description=Cloudera ODBC Driver for Apache Hive (64-bit)
Driver=/opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so
## The option below is for using unixODBC when compiled with -DSQL_WCHART_CONVERT.
## Execute 'odbc_config --cflags' to determine if you need to uncomment it.
# IconvEncoding=UCS-4LE
#!/usr/bin/env bash
yum install unixODBC
wget https://downloads.cloudera.com/connectors/hive-2.5.0.1001/Linux/EL6/ClouderaHiveODBC-2.5.0.1001-1.el6.x86_64.rpm
rpm -ivh ClouderaHiveODBC-2.5.0.1001-1.el6.x86_64.rpm
cp /opt/cloudera/hiveodbc/Setup/cloudera.hiveodbc.ini ~/.cloudera.hiveodbc.ini
cp /opt/cloudera/hiveodbc/Setup/odbc.ini ~/.odbc.ini
cp /opt/cloudera/hiveodbc/Setup/odbcinst.ini ~/.odbcinst.ini
find / -name *odbc*.so
odbcinst -j
odbcinst -s -q
isql -v Hive64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment