[R] Intermittent connectivity issues for JDBC / Oracle

R. Michael Weylandt michael.weylandt at gmail.com
Thu Oct 4 12:20:59 CEST 2012


On Thu, Oct 4, 2012 at 4:29 AM, dh_ss <david at serendipityscience.com> wrote:
> I have been experiencing issues with an R script hanging when connecting to
> an Oracle database.  To help debug, I found a function here in the nabble
> forum and made a small test script:
>
>   #!/usr/bin/Rscript --no-restore --no-save --no-init-file
>   library("RJDBC")
>   drv<-JDBC("oracle.jdbc.OracleDriver","/home/oracle/lib/ojdbc6.jar", "'")
>
>   dbCheck = function(url, user='', pwd='') {
>     j = .jcall("java/sql/DriverManager", "Ljava/sql/Connection;",
>   "getConnection", url, user, pwd, check=FALSE)
>     x = .jgetEx()
>     .jcheck()
>     x
>   }
>   dbCheck("jdbc:oracle:thin:@192.168.3.10:1521:psrndpt1","myuser","mypass")
>
>
> When I run the file - sometimes it works, returning NULL, and sometimes it
> hangs for between 1 and 2.5 minutes before throwing an error.  The database
> is new and stable, on the same network - with no connection issues from any
> other clients.  This machine isn't currently doing anything else except for
> running this script.  Output from running it several times looks like this:
>
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> NULL
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> NULL
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> NULL
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> NULL
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> NULL
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> NULL
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> Error in .jcall("java/sql/DriverManager", "Ljava/sql/Connection;",
> "getConnection",  :
>   ignoring SIGPIPE signal
> Calls: dbCheck -> .jcall -> .External
> Execution halted
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> Error in .jcall("java/sql/DriverManager", "Ljava/sql/Connection;",
> "getConnection",  :
>   ignoring SIGPIPE signal
> Calls: dbCheck -> .jcall -> .External
> Execution halted
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> NULL
> R at ss-dev:~/scripts$ ./dbCheck.R
> Loading required package: methods
> Loading required package: DBI
> Loading required package: rJava
> Error in .jcall("java/sql/DriverManager", "Ljava/sql/Connection;",
> "getConnection",  :
>   ignoring SIGPIPE signal
> Calls: dbCheck -> .jcall -> .External
> Execution halted
>
>
> The times that it returns NULL, it returns immediately.  When it throws the
> error, it is a varying amount of time between roughly 1 and 2.5 minutes.
> Both machines are not busy at all.
>
> Any ideas would greatly appreciated.  Thanks.
>

I'd suggest you take this to the R-SIG-DB (Databases) mailing list
instead. I don't think it's mirrored on the abomination that is
Nabble, so you'll have to subscribe and post there:
https://stat.ethz.ch/mailman/listinfo/r-sig-db

Note that they'll most certainly want your OS, rJava version, JVM
version, R version, and relevant info about the Oracle DB as well.

Cheers,
Michael




More information about the R-help mailing list