0

I'm new to Python development and I am trying to set up a Python/Flask project on my Mac (Mavericks) to connect with an MSSQL server via pyodbc + freetds + unixodbc.

I can connect and query the server using isql and osql, but I can't get pyodbc to connect.

How I got isql and osql working:

  • install python via brew: brew install python
  • installed pip and virtualenv
  • install unixodbc via brew: brew install unixodbc
  • install freetds via brew: brew install freetds --with-unixodbc
  • update freetds.conf, odbc.ini (odbc.ini pointing directly to driver)
  • update permissions on lib to make executable: chmod 554 /usr/local/lib/libtdsodbc.so

At this point, I can successfully connect. Now, for the pyodbc part...

  • from within my virtualenv, install pyodbc sudo pip install pyodbc

Depending on my connection string, I get some variation of this error:

DBAPIError: (Error) ('IM002', '[IM002] [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded (0) (SQLDriverConnect)') None None

It looks like it's trying to use iODBC instead of unixODBC, which is probably my first problem.

How can I get pyodbc to use unixODBC?

minboost
  • 2,555
  • 1
  • 15
  • 15

1 Answers1

2

For anyone trying to figure this out, I got it to work my using pymssql instead of pyodbc.

minboost
  • 2,555
  • 1
  • 15
  • 15