I'm looking to connect SQL Server with R using the odbc and DBI library for the first time on OSX Big Sur 11.1 but when I run dbConnect() I get the following error:
library(odbc)
library(DBI)
sql_conn <- dbConnect(
odbc::odbc(),
driver = "/usr/local/lib/libmsodbcsql.13.dylib",
server = "xxxxx",
Database = "xxxxx",
uid = "xxxxx",
pwd = "xxxxx",
port = xxxx)
Error: nanodbc/nanodbc.cpp:983: 00000: [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libmsodbcsql.13.dylib' : file not found
Literally the file with the exact path /usr/local/lib/libmsodbcsql.13.dylib exists and the error is still saying it doesn't. Here is a screenie of my Finder: Finder SS of /usr/local/lib/libmsodbcsql.13.dylib
I tried assigning the driver argument in dbConnect() to the filepath but to no avail. This is the same error that happens when I assign "{ODBC Driver 13 for SQL Server}" to driver.
I have reinstalled my drivers countless times using the info found on Microsoft's website and I think I may have installed both the ODBC Driver 17 and ODBC Driver 13 for SQL Server which the troublshooting on Microsoft seems to point to being an issue getting the ODBC connection to work. Here's the thread that talks about this: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/known-issues-in-this-version-of-the-driver?view=sql-server-ver15#connectivity
How do I uninstall a UnixODBC driver and is that the correct solution to getting my SQL Server connection working?