1
我想連接到netezza服務器。這是我的代碼有使用pyodbc的netezza連接錯誤
import pyodbc
conn = pyodbc.connect("DRIVER={NetezzaSQL};SERVER=<Server name>;PORT=<no>;DATABASE=<dbname>;UID=user_id;PWD=password;DSN=NZSQL")
print("Connection complete")
我odbc.ini文件是:
[NZSQL]
Driver32=C:\windows\SysWOW64\nsqlodbc.dll
[ASTEST]
Driver32=C:\windows\SysWOW64\cwbodbc.dll
[ODBC 32 bit Data Sources]
NZSQL=NetezzaSQL (32 bit)
ASTEST=iSeries Access ODBC Driver (32 bit)
ASPROD=iSeries Access ODBC Driver (32 bit)
[ASPROD]
Driver32=C:\windows\SysWOW64\cwbodbc.dll
我ODBCINST.INI文件是:
[IBM DB2 ODBC DRIVER - TACOM32 (32 bit)]
Driver=C:\PROGRA~2\QUESTS~1\TOADDA~1.2\SQLLIB\BIN\DB2CLI.DLL
Setup=C:\PROGRA~2\QUESTS~1\TOADDA~1.2\SQLLIB\BIN\DB2ODBC.DLL
32Bit=1
[ODBC 32 bit Drivers]
IBM DB2 ODBC DRIVER - TACOM32 (32 bit)=Installed
MySQL ODBC 5.1 Driver (ToadDataPoint3.8) (32 bit)=Installed
[MySQL ODBC 5.1 Driver (ToadDataPoint3.8) (32 bit)]
Driver=C:\Program Files (x86)\Dell\Toad Data Point 3.8\Plugins\MySQL\ODBC\lib\myodbc5.dll
Setup=C:\Program Files (x86)\Dell\Toad Data Point 3.8\Plugins\MySQL\ODBC\lib\myodbc5S.dll
但它給我下面的錯誤:
pyodbc.Error: ('08001', '[08001] Client unable to establish connection (12) (SQLDriverConnect)')
我不明白這個錯誤。這是netezza錯誤還是我的connect語句錯誤?先謝謝你! :)
您是否在'odbc.ini'文件中輸入了'NetezzzaSQL'? –
不,我沒有。你做什麼意思? –
當您提及'DRIVER = {NetezzaSQL}'時,它會從mediouoned驅動程序的'odbc.ini'文件的條目中讀取配置。選中此項:https://www.ibm.com/support/knowledgecenter/SSZJPZ_8.7.0/com.ibm.swg.im.iis.conn.netezza.use.doc/topics/configuring_nzodbc_linuxfile.html –