microsoft / homebrew-mssql-release

Other
92 stars 31 forks source link

weird behavior on Mac M1 when using msodbcsql18 #91

Closed flixman closed 11 months ago

flixman commented 1 year ago

I am trying to install msodbsql18, so that I can interact from a Mac M1 with a SQL database in azure:

brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18

After this, I install pyodbc and I run the following script:

import pyodbc

server = 'server'
database = 'database'
username = 'username'
password = 'password'
driver = '{ODBC Driver 18 for SQL Server}'
conn = pyodbc.connect('DRIVER='+driver+';SERVER=tcp:'+server+';DATABASE='+database+';UID='+username+';PWD='+ password)

when running the connection line, this is what I get back:

>>> conn = pyodbc.connect('DRIVER='+driver+';SERVER=tcp:'+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
pyodbc.OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 18 for SQL Server]Client unable to establish connection because an error was encountered during handshakes before login. Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server. (26) (SQLDriverConnect)')

Should I run the same script from a linux box, it just works. I have seen some suggestions on the internet about installing the whole python setup, as well as msodbcsql18, using x86_64 emulation through rosetta... but I am getting again the same error.

v-chojas commented 1 year ago

Are you using same version of ODBC driver?

David-Engel commented 11 months ago

Closing as inactive.