dhinar1991
dhinar1991

Reputation: 881

how to read data from Cassandra (DBeaver) to R

I am using Cassandra CQL- system in DBeaver database tool. I want to connect this cassandra to R to read data. Unfortunately the connection takes more time (i waited for more than 2 hours) with RCassandra package. but it does not seem to get connected at all and still loading. Does anyone has any idea on this?

the code as follows:

library(RCassandra)
rc <- RC.connect(host ="********", port = 9042)
RC.login(rc, username = "*****", password = "******")

after this step RC.login, it is still loading for more than 2 hours.

I have also tried using RJDBC package like posted here : How to read data from Cassandra with R?.

library(RJDBC)
drv <- JDBC("org.apache.cassandra.cql.jdbc.CassandraDriver", 
            list.files("C:/Program Files/DBeaver/jre/lib",
                       pattern="jar$",full.names=T))

But this throws error

Error in .jfindClass(as.character(driverClass)[1]) : class not found

None of the answers are working for me from the above link.I am using latest R version 3.4.0 (2017-04-21) and New version of DBeaver : 4.0.4.

Upvotes: 2

Views: 3138

Answers (1)

Edmon
Edmon

Reputation: 4872

For your first approach, which I am less familiar with, should you not have a line that sets the use of the connection?

such as:

library(RCassandra)
c <- RC.connect(host ="52.0.15.195", port = 9042)
RC.login(c, username = "*****", password = "******")
RC.use(c, "some_db")

Did you check logs that you are not getting some silent error while connecting?

For your second approach, your R program is not seeing a driver in a classpath for Java (JMV).

See this entry for help how to fix it.

Upvotes: 1

Related Questions