我想从运行Mac OS X的本地计算机上用Python开发,并连接到网络中的Vertica数据库。

我下载了Vertica Mac Driver,并根据说明进行了设置。使用iODBC进行测试时,我得到:

$ iodbctest
iODBC Demonstration program
This program shows an interactive SQL processor
Driver Manager: 03.52.0607.1008

Enter ODBC connect string (? shows list): ?

DSN                              | Driver
------------------------------------------------------------------------------
VerticaDSN                       | Vertica

Enter ODBC connect string (? shows list): VerticaDSN
1: SQLDriverConnect = [DSI] The error message InvalidConnStr could not be found in the       en-US locale. Check that /en-US/ODBCMessages.xml exists. (-1) SQLSTATE=HY000


使用unixODBC进行测试时,出现了另一个错误:

    $ isql -v VerticaDSN user pw
[S1000][unixODBC][DSI] The error message NoSQLGetPrivateProfileString could not be found in the en-US locale. Check that /en-US/ODBCMessages.xml exists.
[ISQL]ERROR: Could not SQLConnect


后者应由缺少的vertica.ini引起,但我确实添加了vertica.ini并将其目录导出到VERTICAINI环境变量。这是我的vertica.ini的样子:

[Driver]
DriverManagerEncoding=UTF-32
ODBCInstLib=/usr/lib/libiodbc.2.dylib
ErrorMessagesPath=/Users/rmedri/Library/ODBC/vertica/lib64
LogLevel=4
LogPath=/Users/rmedri


这是我的odbc.ini(在〜/ Library / ODBC /中):

[ODBC Data Sources]
VerticaDSN = Vertica
[VerticaDSN]
Driver = /Users/rmedri/Library/ODBC/vertica/lib64/libverticaodbc.dylib
Database = vbit
Servername = vertica-prod.<xxxx>.<xxxx>.com
UID = user
PWD = pw
Port = 5433


我已经花了几个小时了,我很茫然。感谢所有指导,包括从Mac OS X上运行的Python连接到Vertica的替代方法。

最佳答案

我知道这对我们来说是一个反复的尝试,但是最终我们需要:

DriverManagerEncoding=UTF-16


而不是vertica.ini中的UTF-32。

关于python - 尝试从Mac OS X连接到Vertica时无效的连接字符串,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14660015/

10-11 19:34