下载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
<code><span>[ODBC Data Sources]</span><span>Sample_Cloudera_Impala_DSN_64=<span>Cloudera Impala ODBC Driver <span>64</span>-bit</span></span><span>[Sample_Cloudera_Impala_DSN_64]</span><span>Driver=<span>/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib</span></span><span>HOST=<span><span>192.168</span>.<span>2.103</span></span></span><span>PORT=<span><span>21050</span></span></span></code>
vi /usr/local/Cellar/unixodbc/2.3.2_1/etc/odbcinst.ini
<code>[<span>ODBC</span><span>Drivers</span>] <span>Cloudera</span><span>Impala</span><span>ODBC</span><span>Driver</span><span>64</span>-bit=<span>Installed</span>[<span>Cloudera</span><span>Impala</span><span>ODBC</span><span>Driver</span><span>64</span>-bit] <span>Description</span>=<span>Cloudera</span><span>Impala</span><span>ODBC</span><span>Driver</span> (<span>64</span>-bit) <span>Driver</span>=<span>/opt/cloudera</span><span>/impalaodbc/lib</span><span>/universal/libclouderaimpalaodbc</span>.dylib</code>
测试:
isql -v Sample_Cloudera_Impala_DSN_64
PHP连接:
<code><span><span><?php </span><span>$connection</span>=odbc_connect(<span>'Sample_Cloudera_Impala_DSN_64'</span>,<span>''</span>,<span>''</span>); <span>$SQL_Exec_String</span>=<span>"show tables"</span>; <span>$result</span>=odbc_exec(<span>$connection</span>, <span>$SQL_Exec_String</span>); <span>while</span>(odbc_fetch_row(<span>$result</span>)) { <span>$Tables</span>=odbc_result(<span>$result</span>, <span>1</span>); <span>echo</span><span>$Tables</span>.<span>'<br>'</span>; } <span>?></span></span></span></code>').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介绍了mac配置impala odbc,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。