Export to GitHub

pyodbc - issue #395

ODBC to Netezza Database Connection issue


Posted on Apr 1, 2015 by Quick Cat

I am getting a funny error for Pyodbc I used the code below and the Error I received running the code is below. I have also attached the configuration files.

This is the code that I have entered using python 2.6 in linux Red Hat 64bit

import pyodbc

print pyodbc.dataSources()

print "Connecting via ODBC"

conn = pyodbc.connect("DRIVER={NetezzaSQL};SERVER=localhost;PORT=5668;DATABASE=Database;UID=santiago;PWD=ha123;") Error

This is the true error I received when running pyodbc. I don't know what this language is or what it means?

{'ODBC': '', 'NetezzaSQL': '/usr/local/nz_7.2.0.3/lib64/libnzodbc.so'} Connecting via ODBC Traceback (most recent call last): File "connect.py", line 41, in <module> conn = pyodbc.connect("DRIVER{NetezzaSQL};SERVER=localhost;PORT=5668;DATABASE=Database;UID=santiago;PWD=ha123;") pyodbc.Error: ('H00', '[H00] [unixODBC]Sre n/rpr trbtsaeepy\xc8 (33) (SQLDriverConnectW)') obdcinst.ini

Attachments

Comment #1

Posted on Jul 26, 2015 by Swift Hippo

This happens when different parts of your stack have different unicode handling. For me ( same NZ libraries, unixODBC-2.3.2, Perl's DBD::ODBC ), this happens when I build DBD::ODBC with unicode support, and have the UnicodeTranslationOption setting in the odbcinst.ini ( unixODBC config file ) set to utf8 ... ie:

UnicodeTranslationOption = utf8

Change this to:

UnicodeTranslationOption = utf16

... and things should work. Unfortunatley for me ( and many others, I assume ), something in the stack is just absolute crap, and doesn't honour this setting in the global version ( for me, /etc/unixODBC/odbcinst.ini ). Copying this file ( or sym-linking it ) to ~/.odbcinst.ini fixes this. Strange bug ...

By the way, if you're interested in Netezza software, check out Smart Associates: http://www.smart-associates.biz/ ... we have lots of cool utilities, including an ETL framework specially designed for Netezza, migration utilities, data validation utilities, etc. Also check out some of our videos at: https://vimeo.com/smartassociates

Status: New

Labels:
Type-Defect Priority-Medium