1

Whenever I try to make a JDBC object:

jdbcDriver <- JDBC(driverClass="oracle.jdbc.OracleDriver", 
               classPath="~/ojdbc6.jar")

My RStudio immediately crashes with no warning with this popup

enter image description here

However, the code works perfectly in the terminal R environment outside of RStudio, so I am certain it is an RStudio issue.

OS: Mac OS High Sierra 10.13.6

latest version of RStudio (1.1.456) and R (3.5.1).

JDK version 1.8.0_191

Using ojdbc6.jar

3
  • 1
    Up front: I don't use RStudio or a mac, and have shied away from rJava for a while ... but here's a thought: take a look at the (verbose) output of Sys.getenv() both in and out of RStudio to see if you can find distinct differences. Perhaps: e <- Sys.getenv(); writeLines(paste(names(e), e, sep="|"), "file1");, repeat in the other platform into file2, then on the terminal/command-linej type diff file1 file2 (in the correct directory). It might give you an indication if an env var is "different-enough".
    – r2evans
    Oct 29, 2018 at 18:46
  • Might be related but Oracle for odbc package spins forever in RStudio. But placing options(connectionObserver = NULL) at the very top of script to avoid getting connection data for all its 500+ system tables, eliminated that problem for me.
    – Parfait
    Oct 29, 2018 at 18:55
  • 1
    @r2evans, I was able to do the diff between file1 and file2 and noticed that R terminal environment had JAVA_HOME set but RStudio did not. I was able to then fix the problem by including the JAVA_HOME path in my RStudio by creating the .Renviron file and setting it there. Thank you! Oct 29, 2018 at 19:15

1 Answer 1

1

I set JAVA_HOME in my terminal, but somehow it didn't "work" for RStudio.

So the fix was that I created an .Renviron file and put the following inside:

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home

That did the trick

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.