Closed Ethan-Harris0n closed 2 years ago
What are the contents of /opt/homebrew/etc/odbcinst.ini
? Also, if you have /etc/odbcinst.ini
what are its contents?
For /opt/homebrew/etc/odbcinst.ini
:
[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/homebrew/Cellar/msodbcsql17/17.8.1.1/lib/libmsodbcsql.17.dylib
UsageCount=7
For /etc/odbcinst.ini
:
[ODBC Driver 17 for SQL Server] Description=Microsoft ODBC Driver 17 for SQL Server Driver=/usr/local/lib/libmsodbcsql.17.dylib UsageCount=1
Thanks for the help!
It looks like there are two unixODBC driver managers installed, one from brew and the other one probably by downloading the tar.gz directly.
The most "proper" solution is to uninstall and clean out the non-brew one, which would involve finding the directory where it was installed from and running sudo make uninstall
.
An easier workaround might be to simply edit /etc/odbcinst.ini
to point to the correct driver /opt/homebrew/Cellar/msodbcsql17/17.8.1.1/lib/libmsodbcsql.17.dylib
but that would mean using potentially older unixODBC (and having similar problems when upgrading/uninstalling/installing ODBC driver again, especially since the version is in the directory)
Ideally it's best to have only one driver manager, but in my experience on some Linuxes uninstalling a duplicate unixODBC has sometimes been more tricky than it should be, having to manually locate some files and deleing them after make uninstall
, I never tried it on the Mac, but just wanted to give a word of caution, given that's a problem I've seen before.
Thanks for the advice - Tried the non-installation fix you suggested (pasting the correct path in the .ini file) and no luck there. Any additional recommendations? I installed this via homebrew directly and then pyodbc via conda. Any advice on how to return to a clean install? or any other things I should attempt. Thanks so much for the help!
Update - I ended up uninstalling everything and then going the freetds route. Thanks again for the support @v-makouz!
So I've combed through the issues here.
I followed microsoft's documentation to install on a brand new M1 Macbook pro. I am trying to connect through pyodbc in visual studio code and am at a loss on what to try out next. I am pretty stumped as I had a macbook air M1 that I had set up with this same framework (that unfortunately died on me).
When I attempt the following call in VScode:
conn = pyodbc.connect(server = 'xxx', database = 'xxx', user = 'xxx', password = 'xxx', port=xxx, driver='ODBC Driver 17 for SQL Server')
I receive the error:
I have installed from a non-rosetta terminal.
To get ahead of some of the suggestions I've seen in closed issues:
oodbcinst -j
returns:unixODBC 2.3.9 DRIVERS............: /opt/homebrew/etc/odbcinst.ini SYSTEM DATA SOURCES: /opt/homebrew/etc/odbc.ini FILE DATA SOURCES..: /opt/homebrew/etc/ODBCDataSources USER DATA SOURCES..: /Users/ethan.harrison/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8
which isql
returns:/opt/homebrew/bin/isql
Would sincerely appreciate any help as I am just completely at a loss to what to do/try next!