I am trying to connect R to Cassandra and I am getting the following error - even though I explicitly add this directory folder to the classpath before I run the code (and I also point to the classpath within the statement)? Thanks for any help!
require(RJDBC)
.jaddClassPath("C:\\Users\\atrombley\\Desktop\\R\\")
cassdrv <- JDBC("org.apache.cassandra.cql.jdbc.CassandraDriver",
"C:\\Users\\atrombley\\Desktop\\R\\cassandra-jdbc-1.2.5.jar")
Error in .jfindClass(as.character(driverClass)[1]) : class not found
In my case, the database driver was missing from the location named in my call of JDBC(). Just added the Jar to that location and it works! For example:
JDBC(driverClass="com.vertica.jdbc.Driver", classPath="C:/Program Files/Vertica Systems/JDBC/vertica-jdbc-7.2.1-0.jar")
This helpful clue resulted from turning on debugging:
.jclassLoader()$setDebug(1L)
as advised here: https://github.com/s-u/RJDBC/issues/26
Cassandra JDBC driver v1.2.5 does not work with Cassandra 2.* and is very very deprecated, still uses the thrift API and does only connect to a single node.
You should grab the new version I made that uses the Datastax Java Driver underneath : https://github.com/adejanovski/java-driver
Here's a link to the compiled version with all the necessary dependencies : https://drive.google.com/file/d/0B7fwX0DqcWSTLUFqSEMxVFVWY2M/view?usp=sharing
Use the appropriate driver class and JDBC url as shown on this page : https://github.com/adejanovski/java-driver/tree/2.1/driver-jdbc
Another more efficient option (though I'm not familiar with R) should be to use R on Spark and access Cassandra through the spark-cassandra connector provided by Datastax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With