Pyodbc and Pymssql connection trouble after update to macOS Sonoma

232 views Asked by At

After upgrading to macOS Sonoma I am no longer able to connect to some sql servers using pymssql or pyodbc. However, I able to run my program as usual using docker. I am using the driver ODBC Driver 18 for SQL Server, and I have encrypt set to no and trust_server_certificate set to yes.

All the fixes I find is pre Sonoma. Any suggestions?

This is what I get when running my program now:


File "src/pymssql/_pymssql.pyx", line 647, in pymssql._pymssql.connect

File "src/pymssql/_mssql.pyx", line 2109, in pymssql._mssql.connect

File "src/pymssql/_mssql.pyx", line 701, in pymssql._mssql.MSSQLConnection.__init__

File "src/pymssql/_mssql.pyx", line 1818, in pymssql._mssql.maybe_raise_MSSQLDatabaseException

File "src/pymssql/_mssql.pyx", line 1835, in pymssql._mssql.raise_MSSQLDatabaseException

MSSQLDatabaseException: (20017, b'DB-Lib error message 20017, severity 9:\nUnexpected EOF from the server (TheIP)\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (TheIP)\nDB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (TheIP)\n')

While handling the above exception, another exception occurred:

File "/Users/lewiuberg/TheCompany/TheUser/worker/src/data/connection.py", line 128, in __connection
    65   def __connection(self) -> PyodbcCursor | PymssqlCursor:  # type: ignore
 (...)
    124                          exit(0)
    125  
    126          case "mssql":
    127              try:
--> 128                  cursor = pymssql.connect(  # type: ignore
    129                      host=self.server,
    ..................................................
     self = Connection(server=TheIP, database=TheDatabase, use
             rname=TheUser, password=***, port=1433, driver=ODBC Driver
              18 for SQL Server, encrypt=yes, trust_server_certificate=ye
             s, connection_timeout=300, readonly=False, connection_type=m
             ssql)
     PyodbcCursor = ~PyodbcCursor
     PymssqlCursor = ~PymssqlCursor
     self.server = 'TheIP'
    ..................................................

File "src/pymssql/_pymssql.pyx", line 653, in pymssql._pymssql.connect
0

There are 0 answers