[R] Intermittent connectivity issues for JDBC / Oracle
dh_ss
david at serendipityscience.com
Thu Oct 4 05:29:06 CEST 2012
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.
--
View this message in context: http://r.789695.n4.nabble.com/Intermittent-connectivity-issues-for-JDBC-Oracle-tp4644960.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list