1

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.

JAY G
  • 553
  • 2
  • 12
  • 21
  • 1
    What do you see if you telnet to hostname port 1521? Is the listener running there, does the hostname resolve to an IP address properly, do you have network connectivity, and - possibly most likely - is there a firewall blocking port 1521? – Alex Poole Jun 15 '16 at 14:01
  • @AlexPoole Yes I do have connectivity. I can ping this host – JAY G Jun 15 '16 at 14:22
  • 1
    But can you connect to port 1521 - `telnet hostname 1521`? If not then there is a firewall blocking you, and you will need to open that port (or get it opened, depending on where the firewall is). It's nothing to do with R or Oracle, it's a network issue. – Alex Poole Jun 15 '16 at 14:23
  • i tried `telnet hostname 1521` . It says connection refused. – JAY G Jun 15 '16 at 14:32
  • Which is either because the listener isn't listening on that address and port (though you'd usually get a 'no listener' message in that case), or because a firewall is blocking that port. – Alex Poole Jun 15 '16 at 14:36

0 Answers0