I am trying to connect to Oracle using RJDBC. My R code works fine on windows environment, When I put it on centos VM, I am facing error. JAVA_HOME is properly set. Required packages RJDBC, rJava are also installed properly.
Here is my code:
library(RJDBC)
jdbcDriver <- JDBC(driverClass="oracle.jdbc.OracleDriver", classPath="/users/myusername/tmp/ojdbc6.jar")
dbConnect(jdbcDriver, "jdbc:oracle:thin:@hostname:1521:service", "myusername", "mypwd")
First 2 statements work fine, but dbConnect fails with following error:
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1], : java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
This looks like a common RJDBC problem. I found few questions related to this issue but so far I have not been able to find the solution.