I am trying to connect to my SQL Server Database using python with pyodbc on my Mac. The full error I get when I run is:
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: collate_byname::collate_byname failed to construct for C/en_CA.
The Python code to connect using the driver is:
import pyodbc
cnxn = pyodbc.connect("Driver={ODBC Driver 17 for SQL Server}"
"Server=simvo-dbs.database.windows.net,1433;"
"Database=degree-planner-db;"
"UID=simvo_admin@simvo-dbs;"
"PWD=McGill_514;"
"loginTimeout=30;")
Other Relevant Files:
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
odbc.ini:
[MSSQL]
TDS_Version = 7.3
Driver = ODBC Driver 17 for SQL Server
Server = simvo-dbs.database.windows.net
Port = 1433
Any idea on what the issue is will be greatly appreciated. I am using a MAC.
I have the same issue and there is no solution, as far as I can tell. But you can workaround it running the script like this:
env LANG=C python3 myscript.py
I hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With