I got following error while run dbGetQuery of RJDBC 0.2-4:
Error in .jcall(rp, "I", "fetch", stride) :
java.lang.OutOfMemoryError: Java heap space
Following is my code:
Sys.setenv(JAVA_HOME='C:/Program Files (x86)/Java/jdk1.7.0_25')
options(java.parameters='-Xmx1g')
library(rJava)
library(rjson)
library(RJDBC)
# Output Java version
.jinit()
print(.jcall("java/lang/System", "S", "getProperty", "java.version"))
jdbcDriver <<- JDBC(driverClass="oracle.jdbc.OracleDriver", classPath="C:/lib/dashboard_lib/ojdbc6.jar")
jdbcConnection <<- dbConnect(jdbcDriver, "...", "...", "...")
dataset <<- dbGetQuery(jdbcConnection, "select * from OPR_DATA.MV_REG_CTRY_MS_QUARTER_AMT")
Can anyone help me with this, thanks very much in advance
Simply change the java.parameters to 8GB before load RJDBC package:
options(java.parameters = "-Xmx8048m")
library("RJDBC")
It would fail for me using:
options(java.parameters = "-Xmx8048m")
library("RJDBC")
However,
options(java.parameters = "-Xmx8g")
library("RJDBC")
worked.
您可以按如下方式增加内存并重新启动您的 Rstudio,它对我有用。
memory.limit(size=10000000000024)
Commenting in case anyone else comes across this thread with the same error. Updating RJDBC (install.packages("RJDBC")) worked for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.