I am trying to create a JDBC driver in R using following code: i have already set the directory to location where .jar folder is located
drv <- JDBC("com.mysql.jdbc.Driver",
"mysql-connector-java-3.1.14-bin-g.jar",
identifier.quote="`")
i get the following error:
Error in .jfindClass(as.character(driverClass)[1]) : class not found
what would be the problem?
the following works for me ie i do not get "class not found" error. I downloaded mysql-connector-java-5.1.38-bin.jar into my current working directory and ran the below without issues
library(RJDBC)
drv <- JDBC(driverClass="com.mysql.jdbc.Driver",
classPath="mysql-connector-java-5.1.38-bin.jar",
identifier.quote="`")
I had a problem loading the script drv <- JDBC("com.mysql.jdbc.Driver","PATH_to_jar", ...)
in R, although the PATH was correct. There was a Java update in my Linux distro which caused the package rJava or RJDBC not to work anymore. Unfortunately, the error message was that class com.mysql.jdbc.Util
could not be found when executing the subsequent dbConnect(drv, ...)
after this update. This was a bit strange and took me a while to figure out that the package was broken, because it loaded correctly using library(RJDBC)
.
My solution was to reinstall rJava and RJDBC to make it work again ( packages.install("rJava") packages.install("RJDBC")
). I recognized it was a Linux problem since the code worked fine in RStudio on Windows.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.