I am attempting to connect to Oracle Database using the
odbc package on macOS High Sierra. I have installed Oracle Instant Client, including the ODBC package, configured a DSN, and can connect within RStudio, i.e., the following works:
conn <- DBI::dbConnect( drv = odbc::odbc(), dsn = "mydsn" )
When I attempt the same from R, I get an error:
Error: nanodbc/nanodbc.cpp:950: 01000: [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libsqora.dylib.12.1' : file not found
Now, the file exists at
/usr/local/Cellar/instantclient-basic/188.8.131.52.0-2/lib and is symlinked into
/usr/local/lib. I think this has something to do with one or more of the following, but I haven't had much luck tracking it down.
- System Integrity Protection
- differences in how RStudio launches R versus launching R at the command line
- something to do with
I've read through this article on the startup differences, but nothing I tweak in R seems to work. In particular, I (unsuccessfully) tried manually setting the path, i.e.,
Sys.setenv(DYLD_FALLBACK_LIBRARY_PATH = "/usr/local/lib")
I'd appreciate any suggestions. I haven't included a reprex because this seems like such an in-the-Mac-weeds problem that I am not even sure what information would be helpful. I should note that this problem also seems to affect rendering R Markdown inside RStudio, e.g., an RMD that contains the
dbConnect() statement will render, and the rendered document will show the 'file not found' error. So, I am guessing that the issues (rendering RMD, launching R from the CLI) are related.
I posted a version of this question on the Oracle Community forums as well, but so far haven't had any replies.
Thank you in advance.