Quantcast

RJDBC doesn't load Oracle driver?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RJDBC doesn't load Oracle driver?

Andre Zege
I am having trouble loading Oracle JDBC driver into RJDBC.
Basically, i installed RJDBC and used it to connect to MySql. However, when i try to load JDBC Oracle driver, it gives me an error message

> drv<-JDBC("oracle.jdbc.driver.OracleDriver", "/pathToDriver/ojdbc6.jar")
Error in .jfindClass(as.character(driverClass)[1])
java.lang.UnsupportedClassVersionError: Bad version number in .class file


Few relevant facts
1. I use this JDBC driver elsewhere, in DBvizualiser, it connects fine
2. I run R and Java on 64 bit Red Hat Linux.
3. I run same version of JRE in DBvizualiser that works with the driver as the version that doesn't work
with RJDBC


What could it be? Would really appreciate someone familiar with RJDBC commenting





More details on versions:

Java version is
------------------------
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)

R version
-------------
R version 2.10.0 (2009-10-26)

OS version
-------------
Linux 2.6.18-164.19.1.el5 #1 SMP Mon May 24 17:03:22 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: RJDBC doesn't load Oracle driver?

Andre Zege
I asked my local java export and his reply was that the driver was compiled with the later version of java that i need to install. I did install it in parallel to existing java and changed JAVA_HOME variable to point to new java directory. I also pre-pended PATH with path to java. Still, when i try to load the driver

>drv<-JDBC("oracle.jdbc.OracleDriver","/pathtodriver/ojdbc6.jar", " ")

Error in .jfindClass(as.character(driverClass)[1]) :
  java.lang.UnsupportedClassVersionError: Bad version number in .class file


I am no Java expert, but it seems that new java is correctly installed, because when i do
>java -version

I get

java version "1.6.0_23-ea"
Java(TM) SE Runtime Environment (build 1.6.0_23-ea-b03)
Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)

which is the latest Java.

Am i doing everything right to make sure that R uses the latest Java? Is there any way to check it?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: RJDBC doesn't load Oracle driver?

Andre Zege
In reply to this post by Andre Zege
Hmm, for the sake of anyone who steps on the same mine. Basically, this class error always say that you need to install latest java. It's not enough to get new jre -- you need to get full latest jdk as well. After that you need to do R reconfiguration, which is done by
R CMD javareconf
Then you need to reinstall rJava package. I don't know why exactly these are the necessary steps but fact is that they are. Wish someone told me. In any case, this thread proved to be an  informative conversation between two or three sophisticated users :).
Loading...