我已经尝试非常仔细地遵循安装指南,以在Mac上为R设置Impala Cloudera ODBC驱动程序,但始终收到以下错误消息:
In odbcDriverConnect("DSN=Impala ODBC Driver") :
[RODBC] ERROR: state IM002, code 0, message [unixODBC][Driver
Manager]Data source name not found, and no default driver specified
这正是我所做的。对于以下引用的每个文件,我确保该文件存在于该位置。
[从http://www.cloudera.com/content/cloudera/en/downloads/connectors/impala/odbc/impala-odbc-v2-5-23.html下载并安装Impala ODBC驱动程序
brew install unixodbc
odbcinst -j
unixODBC 2.3.2
DRIVERS............: /usr/local/etc/odbcinst.ini
SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini
FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources
USER DATA SOURCES..: /Users/summerrae/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
指向DYLD库路径变量:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/cloudera/impalaodbc/lib/universal
echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/cloudera/impalaodbc/lib/universal/" >> ~/.bashrc
编辑的/usr/local/etc/odbc.ini:
[ODBC Data Sources]
# Use this name in your connection string
Impala DSN=Impala ODBC Driver
[Impala DSN]
# Driver: The location where the ODBC driver is installed to.
Driver=/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
# Values for HOST, PORT, Database
HOST=myhost (changed name here for security)
PORT=21050
Database=default
Edited /user/local/etc/odbcinst.ini:
[ODBC Drivers]
Impala ODBC Driver=Installed
[Impala ODBC Driver]
Description=Impala ODBC Driver
Driver=/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
编辑的/opt/cloudera/impalaodbc/lib/universal/cloudera.impalaodbc.ini:
[Driver]
## - Note that this default DriverManagerEncoding of UTF-15
## is for unixODBC.
DriverManagerEncoding=UTF-16
ErrorMessagesPath=/opt/cloudera/impalaodbc/ErrorMessages/
LogLevel=0
LogPath=
## - Note that the path to your ODBC Driver Manager
## must be specified in DYLD_LIBRARY_PATH.
# unixODBC
ODBCInstLib=libiodbcinst.dylib
将路径变量导出到〜/ .bashrc:
#add full path to odbc.ini and add to bashrc
export ODBCINI=/usr/local/etc/odbc.ini
echo "export ODBCINI=/etc/odbc.ini" >> ~/.bashrc
#add directory path to odbcinst.ini and add to bashrc
export ODBCSYSINI=/usr/local/etc/
echo "export ODBCSYSINI=/etc/odbcinst.ini" >> ~/.bashrc
#add full path to cloudera.impalaodbc.ini and add to bashrc
export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/universal/cloudera.impalaodbc.ini
echo "export CLOUDERAIMPALAINI=/opt/cloudera/impalaodbc/lib/universal/cloudera.impalaodbc.ini" >> ~/.bashrc
在R中:
install.packages("RODBC")
library(RODBC)
#connect using impala DSN
conn <- odbcConnect("Impala DSN")
我已经遍历了所有可以使它正常工作的教程。我能够使用Python连接到同一服务器和参数,我能够使用RImpala连接到同一服务器,但是无法获得RImpala包来运行查询,所以我知道连接有效。任何帮助是极大的赞赏。谢谢!
事实证明,优胜美地默认提供的iODBC驱动程序存在问题。我最终重新安装了Mac OS,一切正常。
作为替代,我还发现您可以:
安装mac ODBC管理器
添加以下两个键值对:
HOST your_host_name
PORT 21050
单击“确定”
使用上面创建的DSN名称与RODBC连接。
您的问题是驱动程序安装指向/ usr / local / etc文件夹中的文件以进行配置,而您正在尝试修改驱动程序随附的文件。我遇到了同样的问题,我只在/ usr / local / etc中配置了.ini文件,并且可以连接较少的DNS。