I have been having some trouble getting my connection set up to an Oracle database in R. I recently changed my machine (Dell running Windows) to a MacBook Pro (macOS High Sierra version 10.13.5). After a lot of work with my DBA, was finally able to connect to the database using R (both in the terminal and in R), but when I run the same code to connect in RStudio, I get a fatal error and RStudio crashes. The code I am running is:
library(RODBC)
con <- odbcConnect("dsn", uid = "username", pwd = "password")
I already tried uninstalling and reinstalling RStudio, but the issue is still happening.
I have no clue why this won't work in RStudio. Any help is greatly appreciated.
NOTE: I get the same issue when I use the odbc package instead of RODBC.
Can you share a bit more detail about the fatal error and RStudio crashing? Is there any logging or error message displayed?
The ROracle package has a knack for being very environmentally sensitive. I would do an environment comparison between RStudio and R in the terminal with Sys.getenv(). RStudio does change some environment variables, which may be the reason for your problem. In particular, I would keep an eye out for LD_LIBRARY_PATH, PATH, and friends, as those are some of the most regular culprits.
I have a similar issue. When I use thr RODBC package from R it workd but from Rstudio it errors out:
ch=odbcConnect("DSN=DEV;UID=;PWD=")
Warning messages:
1: In RODBC::odbcDriverConnect("DSN=DEV;UID=;PWD=") :
[RODBC] ERROR: state 08001, code 0, message [Teradata][ODBC Teradata Driver] No DBCName entries were found in DSN/connection-string.
2: In RODBC::odbcDriverConnect("DSN=DEV;UID=;PWD=") :
ODBC connection failed