codepad / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

ODBC to Netezza Database Connection issue #395

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

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

Original issue reported on code.google.com by fandango...@gmail.com on 1 Apr 2015 at 3:14

Attachments:

GoogleCodeExporter commented 8 years ago
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

Original comment by daniel.k...@customerjourneyanalytics.com on 26 Jul 2015 at 1:50