Error In .jcall Java/sql/drivermanager Ljava/sql/connection Getconnection
this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Intermittent connectivity issues for JDBC / Oracle 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@ss-dev:~/scripts$ ./dbCheck.R Loading required package: methods Loading required package: DBI Loading required package: rJava NULL R@ss-dev:~/scripts$ ./dbCheck.R Loading required package: methods Loading required package: DBI Loading required package: rJava NULL R@ss-dev:~/scripts$ ./dbCheck.R Loading required package: methods Loading required package: DBI Loading required package: rJava NULL R@ss-dev:~/scripts$ ./dbCheck.R Loading required package: methods Loading required package: DBI Loading required package: rJava NULL R@ss-dev:~/scripts$ ./dbCheck.R Loading required package: methods Loading required package: DBI Loading required package: rJava NULL R@ss-dev:~/scripts$ ./dbCheck.R Loading required package: methods Loading required package: DBI Loading required package: rJava NULL R@ss-dev:~/scripts$ ./dbCheck.R Loading required package: methods Loading required package: DBI Loading required package: rJava Error
Mark Sandan Tools Studio 15.12 Available for Download fgrimmer Tools Benchmarking and TdBench 7.2 DougEbel Tools Orchestrating an analytic workflow in the Teradata Unified Data Architecture watzke UDA Routing Options in Unity Director 15.00 Paul LaPointe UDA Introduction to Viewpoint 15.11 Mobile craigmitchell Viewpoint An Overview of the new Viewpoint 15.11 Dashboard craigmitchell Viewpoint Teradata Data Lab 15.11 http://r.789695.n4.nabble.com/Intermittent-connectivity-issues-for-JDBC-Oracle-td4644960.html Release gryback Viewpoint Phased Rollouts in Unity Director & Loader Paul LaPointe UDA Why We Love Presto DanGraham Hadoop Transitioning from SQL Assistant to Studio Express fgrimmer Tools Teradata Query Grid and Machine Learning in Hadoop watzke Extensibility Print All Blogs amarek's Blog How to https://developer.teradata.com/blog/amarek/2013/12/how-to-avoid-duplicate-jdbc-connection-created-by-rjdbc-dbconnect avoid duplicate JDBC Connection created by RJDBC dbConnect Blog entry by amarek on 04 Dec 2013 0 comments Tags: rjdbcconnection The implementation of dbConnect in RJDBC version 0.1-5 thru 0.2-2 (http://www.rforge.net/RJDBC/news.html) erroneously creates two (duplicate) connections. The RJDBC version currently in use can be obtained by entering citation("RJDBC") at the R command prompt. RJDBC dbDisconnect only closes one of the two connections, leaving the duplicate connection orphaned. The issue has been reported at https://github.com/s-u/RJDBC/commit/c6a0907822d6bcfe003f4de38bd4c65ae7c261aa#commitcomment-4772766 and https://github.com/s-u/RJDBC/issues/1. There are two workarounds until RJDBC dbConnect is fixed: Avoid RJDBC dbConnect and dbDisconnect. Invoke JDBC DriverManager.getConnection() and JDBC Connection.close() directly. drv = JDBC("com.teradata.jdbc.TeraDriver","c:\\terajdbc\\terajdbc4.jar;c:\\terajdbc\\tdgssconfig.jar") con = .jcall("java/sql/DriverManager","Ljava/sql/Connection;","getConnection", "jdbc:teradata://system","user","password") s = .jcall(con, "Ljava/sql/Statement;", "createStatement") rs = .jcall(s, "Ljava/sql/ResultSet;", "executeQuery", "SELECT SessionNo,TRIM(UserName),LogonSource FROM DBC.SessionInfo ORDER BY SessionNo") md = .jcall(rs, "Ljava/sql/ResultSetMetaData;", "getMetaData") jr = new("JDBCResult", jr=rs, md=md, stat=s, pull=.jnull()) fetch(jr, -1) .jcall(rs,"V","clos
Re: Intermittent connectivity issues for RJDBC / Oracle Newsgroups: gmane.comp.lang.r.db Date: Friday 5th October 2012 00:38:51 UTC (over 4 years ago) Well as it is, I am already going against an Oracle database - so the checks are already http://permalink.gmane.org/gmane.comp.lang.r.db/788 out the door. My issue is how to connect R that runs on a different application server to connect to the Oracle instance on the database server. I read Dennis' comment as https://support.rstudio.com/hc/en-us/community/posts/203325897-Rstudio-Connectivity-issue-with-Teradata- using another type of driver to connect to the Oracle DB. If you or he were referring to the R that Oracle has embedded in the DB - that is definitely out of error in the question. But if it is driver - to respond to Denis, I didn't use ROracle because it didn't install correctly and I gave up. I just went through the process again. I downloaded these files... -rw-r--r-- 1 R ss 60331694 Oct 4 18:08 instantclient-basic-linux.x64-11.2.0.3.0.zip -rw-r--r-- 1 R ss 641586 Oct 4 18:11 instantclient-sdk-linux.x64-11.2.0.3.0.zip -rw-r--r-- 1 R ss 151972 Oct 4 18:05 ROracle_1.1-5.tar.gz unzipped both error in .jcall to this dir: [emailprotected]:/home/oracle/instantclient_11_2$ ls -al total 182076 drwxr-xr-x 3 root root 4096 Oct 4 18:13 . drwxrwxrwx 5 R ss 4096 Oct 4 18:13 .. -rwxrwxr-x 1 root root 25308 Sep 17 2011 adrci -rw-rw-r-- 1 root root 437 Sep 17 2011 BASIC_README -rwxrwxr-x 1 root root 46228 Sep 17 2011 genezi -rwxrwxr-x 1 root root 52761218 Sep 17 2011 libclntsh.so.11.1 -r-xr-xr-x 1 root root 7955322 Sep 17 2011 libnnz11.so -rwxrwxr-x 1 root root 1971762 Sep 17 2011 libocci.so.11.1 -rwxrwxr-x 1 root root 118408281 Sep 17 2011 libociei.so -r-xr-xr-x 1 root root 164836 Sep 17 2011 libocijdbc11.so -r--r--r-- 1 root root 2095661 Sep 17 2011 ojdbc5.jar -r--r--r-- 1 root root 2714016 Sep 17 2011 ojdbc6.jar drwxrwxr-x 4 root root 4096 Sep 17 2011 sdk -rwxrwxr-x 1 root root 191237 Sep 17 2011 uidrvci -rw-rw-r-- 1 root root 66779 Sep 17 2011 xstreams.jar and ran these commands... [emailprotected]:/home/R/Downloads# export OCI_LIB=/home/oracle/instantclient_11_2 [emailprotected]:/home/R/Downloads# export LD_LIBRARY_PATH=/home/oracle/instantclient_11_2:$LD_LIBRARY_PATH [emailprotected]:/home/R/Downloads# R CMD INSTALL ROracle_1.1-5.tar.gz * installing to library â/usr/local/lib/R/site-libraryâ * installing *source* package âROracleâ ... ** package âROracleâ successfully unpacked and MD5 sums checked configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -std=gnu99 -I/usr/share/R/include -I/home/oracle/instantclient_11_2/sdk/include -fpic -O3 -pipe
drv = JDBC("com.teradata.jdbc.TeraDriver","/home/xxxxx/Teradata_jdbc/terajdbc4.jar") Error in .jfindClass(as.character(driverClass)[1]) : class not found drv = JDBC("com.teradata.jdbc.TeraDriver","/home/60043035/Teradata_JDBC/terajdbc4.jar") onn <- dbConnect(drv, "jdbc:teradata://10.191.8.104/app_hadoop", tdlogin, tdpwd) GSSException: Failure unspecified at GSS-API level (Mechanism level: UserFile parameter null) at com.teradata.tdgss.jtdgss.TdgssParseXml.