On Dec 21, 11:00 am, Isaac <
isaac.laugh...@gmail.com> wrote:
> I'm getting the following error when trying to use pyodbc.connect
>
> pyodbc.Error: ('IM002', '[IM002] [iODBC][Driver Manager]Data source
> name not found and no default driver specified. Driver could not be
> loaded (0) (SQLDriverConnectW)')
Did you install unixODBC with MacPorts? I had exactly the same problem
on 10.7 connecting to PostgreSQL and MySQL. I just submitted a patch
to MacPorts[1] that solves it for me.
The trick appears to be adding the MacPorts include/library paths
under /opt/local to setup.py:
settings['include_dirs'] = ['/opt/local/include']
settings['library_dirs'] = ['/opt/local/lib']
I got the hint from this Stack Overflow discussion[2].
Hope this helps!
-B
[1]
https://trac.macports.org/ticket/32706
[2]
http://stackoverflow.com/questions/7881985/using-alternate-unixodbc-installation