RJDBC Cassandra & # 8594; Error in .jfindClass (as.character (driverClass) [1]): class not found

I try to connect R to Cassandra and I get the following error: even if I explicitly add this directory folder to the class path before running the code (and also specify the class path in the instructions)? Thanks for any help!

required (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

+5
source share
5 answers

The Cassandra JDBC v1.2.5 driver does not work with Cassandra 2. * and is very outdated, it still uses the lean traffic API and connects to only one node.

You have to grab the new version that I created that uses the Java Datastax Driver from below: https://github.com/adejanovski/java-driver

Here is 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 (although I am not familiar with R) should be to use R on Spark and access Cassandra through the spark cassandra connector provided by Datastax.

+1
source

In my case, the database driver was not at the location specified in my JDBC () call. Just added Jar to this place and it works! For instance:

 JDBC(driverClass="com.vertica.jdbc.Driver", classPath="C:/Program Files/Vertica Systems/JDBC/vertica-jdbc-7.2.1-0.jar") 

This useful key is caused by debugging enabled:

 .jclassLoader()$setDebug(1L) 

as stated here: https://github.com/su/RJDBC/issues/26

+1
source

So the documentation is terrible there, I was able to find out that you need the following "Dependency" banks, and you need to put them in the same folder as the jar driver file.

JARS List:

Apache-Kassandra thrift-1.2.6 Cassandra-2.1.1 JDBC log4j-1.2.15 SLF4J-simple 1.5.2 libthrift-0.7.0 JACKSON-core-ASL-1.9.2 Cassandra-all-1.2.9 SLF4J-api 1.5.2 Apache-Cassandra clientutil-1.2.6 JACKSON-Mapper-ASL-1.9.2 guava-15.0 SLF4J-log4j12-1.5.2

However, even if you are lucky enough to solve this problem and R finds your driver, you will have a problem and get an error below which no one seems to have fixed yet ......

log4j: WARN No applications were found for the logger (org.apache.cassandra.cql.jdbc.CassandraDriver). log4j: WARN Please initialize the log4j system correctly. Error in .jcall (drv @jdrv, "Ljava / sql / Connection;", "connect", as.character (url) [1]: java.sql.SQLNonTransientConnectionException: org.apache.thrift.transport.TTransportException: Read negative frame size (-2097152000)!

0
source

Add the cassandra-jdbc-1.2.5-1.0.0.jar file to the cassandra / lib folder. This works for me.

0
source

None of the R examples worked for me, and I read that even those that work for you will have to create pagination, which is a pain in $$. Just do it in python using this script and it will be paginated for you.

 import sys sys.path.append('/Library/Python/2.7/site-packages/') import cql from cassandra.cluster import Cluster cluster = Cluster(contact_points=['10.121.xxx.xx'], protocol_version=3); session = cluster.connect(); result = session.execute("select client_id, request_time, request_id,client_ip, exception, method, query_parameters, request_body, resource,response_duration_in_ms, response_http_code, user_id from api.api_usage_log") 
-1
source

All Articles