odbc icon indicating copy to clipboard operation
odbc copied to clipboard

Can't open lib '/opt/homebrew/lib/libmsodbcsql.18.dylib' : file not found

Open Worville opened this issue 3 years ago • 0 comments

Hi,

I'm trying to connect to a SQL Server database through R using {odbc}. Like many others, I'm struggling.

I started by installing the latest version of the Microsoft ODBC driver here and followed the troubleshooting to ensure that the appropriate files are symlinked.

I have an M1 MacBook Pro and have got to the point where I can run the appropriate isql command in the terminal and return a database connection, but trying the following:

con <- DBI::dbConnect(odbc::odbc(), Driver = "ODBC Driver 18 for SQL Server", server = "server_name", Database = "db", UID = "", PWD = "", port = 1433)

Where ODBC Driver 18 for SQL Server is pointing to odbcinst.ini file which contains:

[ODBC Driver 18 for SQL Server] Description=Microsoft ODBC Driver 18 for SQL Server Driver=/opt/homebrew/lib/libmsodbcsql.18.dylib UsageCount=2

Results in:

Error: nanodbc/nanodbc.cpp:1021: 00000: [unixODBC][Driver Manager]Can't open lib '/opt/homebrew/lib/libmsodbcsql.18.dylib' : file not found

The issue seems to be that my R instance can't locate the libmsodbcsql.18.dylib file.

Any help would be much appreciated. I've already considered the following links:

  • https://github.com/microsoft/homebrew-mssql-release/issues/53
  • https://stackoverflow.com/questions/61628762/cant-open-lib-odbc-driver-17-for-sql-server-in-python

Worville avatar Aug 03 '22 18:08 Worville