2

I am having some trouble getting PYODBC to work on my Windows machine.

import pyodbc
c = pyodbc.connect('DSN=netezza')

The error returned says:

Error: ('IM003', '[IM003] Specified driver could not be loaded due to system error 193 ...')

Googling this error revealed that it may be a problem with 32-bit vs 64-bit drivers. And the other post suggests that the default administrator for PYODBC uses the 64-bit data source administrator. In fact, I notice that when I fire up WinSQL, it can successfully connect to the the database without any problems as it seems to be using a different data source administrator (the 32-bit version). However, I can't figure out how to specify the 32-bit data source administrator for PYODBC. I understand that I should be pointing PYODBC to %windir%\SysWOW64\odbcad32.exe but I just don't know where I need to specify this.

Update:

import pyodbc
c = pyodbc.connect('DRIVER={NetezzaSQL};SERVER=<ip address>;PORT=<port>;DATABASE=<db>;UID=<username>;PWD=<password>')

This also produced the exact same error as described above.

Community
  • 1
  • 1
slaw
  • 6,591
  • 16
  • 56
  • 109

2 Answers2

0

The architecture version of python and the ODBC driver must match.

For example, if you have a 32-bit Netezza driver installed, you need 32-bit python. If you have a 64-bit driver, 64-bit python is required.

You can start an interactive python shell to confirm what is in your path (the below screenshot is 64-bit python):

python interactive shell

Bryan
  • 17,112
  • 7
  • 57
  • 80
  • But the comments in this post: http://stackoverflow.com/questions/11108862/how-to-install-pyodbc-64-bit. suggests that one could use the 32-bit ODBC administrator (odbcad32.exe) with a 64-bit python installation (I'll have to check but I believe that I have 64-bit Python). I don't mean to debate the point but I don't see why a 64-bit Python is not compatible with 32-bit drivers. I can understand 32-bit Python not being compatible with 64-bit drivers. – slaw Dec 03 '14 at 03:12
  • So, is there a way to specify the driver?? What happens if both the 32-bit driver and the 64-bit driver are installed? How can this be reconciled?? – slaw Dec 09 '14 at 02:14
-1

Try this:

c = pyodbc.connect('DRIVER={SQL Server};DSN=netezza')

Optionally, you can use this form:

c = pyodbc.connect('DRIVER={SQL Server};SERVER=yourserver.com;DATABASE=netezza;UID=youruser;PWD=yourpassword')

I hope this helps!

FlipperPA
  • 13,607
  • 4
  • 39
  • 71
  • Unfortunately, that did not help. The error is still the same. Can you explain the logic of how doing it this way would change anything? Are you suggesting that specifying the driver could somehow alter the data source administrator (32-bit vs 64-bit) being used? – slaw Dec 02 '14 at 19:18
  • Netezza is a data warehouse appliance, and is not accessible via ODBC driver for SQL Server. – Bryan Dec 02 '14 at 21:31
  • Aha, I knew I'd heard of Netezza somewhere before... I thought he was just referencing a database called Netezza. Is it possible there is a database for the appliance metadata? – FlipperPA Dec 03 '14 at 20:13