导航

mac配置impala odbc

Posted on 2016-02-20 11:10  ggzone  阅读(802)  评论(0编辑  收藏  举报

下载mac对应驱动并安装:http://www.cloudera.com/downloads.html.html

*HOST 地址是impala Daemon所在的机器ip,端口可以在cm中设置
vi /usr/local/Cellar/unixodbc/2.3.2_1/etc/odbc.ini

[ODBC Data Sources]
Sample_Cloudera_Impala_DSN_64=Cloudera Impala ODBC Driver 64-bit

[Sample_Cloudera_Impala_DSN_64]
Driver=/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
HOST=192.168.2.103
PORT=21050

vi /usr/local/Cellar/unixodbc/2.3.2_1/etc/odbcinst.ini

[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/universal/libclouderaimpalaodbc.dylib

测试:
isql -v Sample_Cloudera_Impala_DSN_64

PHP连接:

<?php
$connection=odbc_connect('Sample_Cloudera_Impala_DSN_64','','');
$SQL_Exec_String="show tables";
$result=odbc_exec($connection, $SQL_Exec_String);
while(odbc_fetch_row($result))
{
$Tables=odbc_result($result, 1);
echo $Tables.'<br/>';
}
?>