环境配置过程:
1 unixODBC依赖包的安装
- 检查是否安装unixODBC包
$ rpm -qa |grep -i unixodbc
- 安装unixODBC依赖包
$ sudo yum -y install unixODBC unixODBC-devel
1 unixODBC依赖包的安装
- 检查是否安装unixODBC包
$ rpm -qa |grep -i unixodbc
- 安装unixODBC依赖包
$ sudo yum -y install unixODBC unixODBC-devel
配置ODBC DataSource
--------------------------------------------------------------------------------------------------------------------------------
配置后 程序Open链接时 报System.Data.Odbc.OdbcException(0x80131937):ERROR[H]异常
更改Cloudera ODBC Driver for Impala驱动配置文件的编码配置:增加
DriverManagerEncoding=UTF-16
如下:
[Driver]
## - Note that this default DriverManagerEncoding of UTF-32 is for iODBC.
## - unixODBC uses UTF-16 by default.
## - If unixODBC was compiled with -DSQL_WCHART_CONVERT, then UTF-32 is the correct value.
## Execute 'odbc_config --cflags' to determine if you need UTF-32 or UTF-16 on unixODBC
## - SimbaDM can be used with UTF-8 or UTF-16.
## The DriverUnicodeEncoding setting will cause SimbaDM to run in UTF-8 when set to 2 or UTF-16 when set to 1.
DriverManagerEncoding=UTF-16
## UTF-32
ErrorMessagesPath=/opt/cloudera/impalaodbc/ErrorMessages/
LogLevel=0
LogPath=
SwapFilePath=/tmp
## - Uncomment the ODBCInstLib corresponding to the Driver Manager being used.
## - Note that the path to your ODBC Driver Manager must be specified in LD_LIBRARY_PATH (LIBPATH for AIX).
## - Note that AIX has a different format for specifying its shared libraries.
# Generic ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.so
# SimbaDM / unixODBC
#ODBCInstLib=libodbcinst.so
# AIX specific ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.a(libiodbcinst.so.2)
# SimbaDM
#ODBCInstLib=libodbcinst.a(odbcinst.so)
# unixODBC
ODBCInstLib=libodbcinst.a(libodbcinst.so.1)
However, the System.Data.Odbc
should give us an explicit error message, instead of ERROR [H] [unixODBC][.