Suraj Nagabhushana Suraj Nagabhushana - 1 year ago 224
Python Question

Connection error using pyodbc for netezza

I am trying to connect to a netezza server. This is the code I have

import pyodbc

conn = pyodbc.connect("DRIVER={NetezzaSQL};SERVER=<Server name>;PORT=<no>;DATABASE=<dbname>;UID=user_id;PWD=password;DSN=NZSQL")

print("Connection complete")

My odbc.ini file is:

[ODBC 32 bit Data Sources]
NZSQL=NetezzaSQL (32 bit)
ASTEST=iSeries Access ODBC Driver (32 bit)
ASPROD=iSeries Access ODBC Driver (32 bit)

My odbcinst.ini file is:

[IBM DB2 ODBC DRIVER - TACOM32 (32 bit)]
[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

But it gives me the following error:

pyodbc.Error: ('08001', '[08001] Client unable to establish connection (12) (SQLDriverConnect)')

I don't understand this error. Is this a netezza error or is my connect statement wrong? Thank you in advance! :)

Answer Source

Turns out it was a server issues. When python was trying to connect to the server, it had some issue. The same code worked fine the next day. It did say client unable to establish connection.