1,首先安装unixODBC.前文已经安装过,不做赘述.
2,使用https://www.cloudera.com/downloads/connectors/hive/odbc/2-5-24.html下载hiveodbc驱动ClouderaHiveODBC-2.5.24.1017-1.suse12.x86_64.rpm,我这个是适合suse12 64位的版本,可以选择适合自己系统的版本.
3,安装hiveodbc驱动.
因为默认安装会用到/opt/cloudera/和/var/lib/rpm/目录.而我使用的是用户是:hxeadm,所以安装的时候可能会报权限的问题,我为了省事,就直接从/opt和/var赋权给了hxeadm,如果觉着权限太大可以只把使用的目录赋权给用户
#chown -R hxeadm:sapsys /opt/cloudera/
#chown -R hxeadm:sapsys /var/lib/rpm/
#rpm -ivh ClouderaHiveODBC-2.5.24.1017-1.suse12.x86_64.rpm
默认安装目录:/opt/cloudera/hiveodbc/
安装完成后,需要配置odbc.ini和odbcinst.ini
#sudo vi /etc/odbc.ini
[CHIVE]
Driver=/opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so
Description=Hive Cloudera ODBC Driver
Host=10.111.112.153
Port=10000
Schema=test
ServiceDiscoveryMode=0
HiveServerType=2
#AuthMech=0
ThriftTransport=1
UseNativeQuery=0
#sudo vi /etc/odbcinst.ini
[MYSQL]
Driver=/usr/lib/libmyodbc5a.so
SETUP=/usr/lib/libmyodbc5a.so
UsageCount=1
[ODBC]
Trace=Yes
TraceFile=/tmp/odbc.trace.log
测试一下:
#isql -v CHIVE
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
使用eclipse连接HANA.
1,SYSTEM -> Provisioning -> Remote Sources -> New Remote Sources ->
Adapter Name 选择(HADOOP ODBC),
Data Source Name 填写刚刚odbc.ini中配置的CHIVE,然后填写账户名密码
如下图:
然后 Ctrl + s 就可以啦
刚刚接触SAP HANA,一步一步记录....
遇到的bug:
[S1000][unixODBC][Cloudera][ThriftExtension] (5) Error occurred while contacting server: No more data to read.. This could be because you are trying to establish a non-SSL connection to a SSL-enabled server.
[ISQL]ERROR: Could not SQLConnect
原因是在配置的/etc/odbc.ini的时候设置了AuthMech=0,注释掉即可.
#sudo vi /etc/odbc.ini
[CHIVE]
Driver=/opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so
Description=Hive Cloudera ODBC Driver
Host=10.111.112.153
Port=10000
Schema=test
ServiceDiscoveryMode=0
HiveServerType=2
#AuthMech=0
ThriftTransport=1
UseNativeQuery=0