dbConnect on oracle works in R but fails in RStudio

I am attempting to connect to Oracle Database using the odbc package on OSX High Sierra. I installed version 19-3 of the instantclient and use unixodbc 2.3.7. Following this link, I turned all the run-paths into absolute paths and managed to make it work in the terminal via isql and when calling R at the command line. However, in RStudio I keep getting the following error:

Error: nanodbc/nanodbc.cpp:983: 00000: [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed

I use the exact same command in R and Rstudio:

con <- DBI::dbConnect(odbc::odbc(), driver = "OracleODBCDriver", ...)

This error persists. In this article, I read that this error may occur if the ORACLE_HOME environment variable is not set. However, mine is set and points to the same directory in the terminal and in RStudio - namely /opt/oracle/instantclient_19_3.

Any ideas would be highly appreciated - I'm really desperate.

PS: One thing catching my eye is the output of otool -l libsqora.dylib.19.1. While in many examples the path to LC_RPATH is @executable_path/../../oracle/lib, mine is /ade/b/3727680341/oracle/lib/.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.