[R] RJDBC cant find driver class in JDBC jar file

David Scott d.scott at auckland.ac.nz
Tue Jun 3 02:40:03 CEST 2008

I can't comment on problems with RJDBC but I can say that if you want to 
access MySQL from R, I have had very little difficulty doing it with 
RODBC. The only difficulty I have experienced is in getting the MySQL 5.0 
server started, which after hours of trying I avoided by using MySQL 5.1.

Setup is easiest with Windows but is possible on Linux where Brian Ripley 
has provided information about how to do it. (I think in the README for 
RODBC---I am trying to remember from a year ago. I have done a Windows 
Vista setup in the past couple of weeks.)

You will need:

MySQL (5.1 recommended although it is a development version)
MySQL Connector ODBC

Some notes on setup on Vista are available at:

I think that, like many other useful tools, the linking of R and MySQL 
owes much to Brian Ripley. He has my gratitude for a nice piece of work.

David Scott

On Mon, 2 Jun 2008, Dan Montgomery wrote:

> I would like to set up a Windows XP environment with R and MySQL.
> This set-up was recommended by a friend who uses this set up, but I
> have been unable to get RJDBC to work.  I have installed all of the
> software today (June 2 2008), first deleting and then replacing old
> versions of software.
> The error is as follows:
> Error in .jfindClass(as.character(driverClass)[1]) : class not found
> This error is produced after running the following code ():
> library(RJDBC)
> drv <- JDBC("com.mysql.jdbc.Driver",
>           "/etc/jdbc/mysql-connector-java-5.1.6-bin.jar",
>           identifier.quote="`")
> This code was modified from code at www.rforge.net/RJDBC to include
> version 5.1.6 of the driver.  Version 3.1.14 gave the same error.  I
> think that R is having trouble finding the class (driver) in the .jar
> file even though I can see it using winzip.  I have limited knowledge
> of R and Java, but use other programing languages for work.  Thank you
> for your help.
> =========
> Environment:
> =========
>> From CRAN
> -R 2.7.0
> Installed in R using the command "install.packages("RJDBC",dep=TRUE)"
> -DBI
> -rJava
>> From MySQL.com
> -mysql-connector-java-5.1.6-bin.jar
> -MySQL 5.0.51b (win32)
>> From Java.com
> -Java 6 update 6
> --
> Daniel Montgomery
> damontgomery at gmail.com
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Scott	Department of Statistics, Tamaki Campus
 		The University of Auckland, PB 92019
 		Auckland 1142,    NEW ZEALAND
Phone: +64 9 373 7599 ext 86830		Fax: +64 9 373 7000
Email:	d.scott at auckland.ac.nz

Graduate Officer, Department of Statistics
Director of Consulting, Department of Statistics

More information about the R-help mailing list