为rodbc安装cloudera impala odbc驱动程序

35g0bw71  于 2021-06-26  发布在  Impala
关注(0)|答案(2)|浏览(447)

我曾尝试非常仔细地按照安装指南在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

我就是这么做的。对于下面引用的每个文件,我确保该文件存在于该位置。
从下载并安装impala odbc驱动程序http://www.cloudera.com/content/cloudera/en/downloads/connectors/impala/odbc/impala-odbc-v2-5-23.html

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 library path变量:

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包运行查询,所以我知道连接是有效的。非常感谢您的帮助。谢谢!

oxiaedzo

oxiaedzo1#

您的问题是驱动程序安装指向/usr/local/etc文件夹中的文件进行配置,而您正试图修改驱动程序附带的文件。我也遇到了同样的问题,我只是在/usr/local/etc中配置了.ini文件,可以少连接dns。

i7uaboj4

i7uaboj42#

原来是iodbc驱动程序的问题,yosemite默认了这个驱动程序。最后我重新安装了mac操作系统,一切都很顺利。
另外,我还发现你可以:
安装mac odbc管理器
从下载文件http://www.odbcmanager.net/
安装后,从应用程序/实用程序打开程序
单击“驱动程序”,然后单击“添加”
浏览到impala驱动程序,默认位置是:/opt/cloudera/impalaodbc/lib/universal/libclouderaimpalaodbc.dylib
添加系统dsn
添加dsn名称,然后单击“添加”
添加以下两个键值对:
主机名
端口21050
单击“确定”
使用上面创建的dsn名称连接rodbc。

相关问题