Reading and Writing to Cassandra Database

Hello,

I want to read and write data to Cassandra Database.However i am unable to find out any reader or writer componet for Cassandra.
Can anyone help me to figure out how to load and read from Cassandra.
Your help would be appreciated .

Thanks
Bhavin

Hi Bhavin,

In order to work with Cassandra DB, you will just need to use external Cassandra JDBC driver, since the driver does not come with the Clover. After you get the driver, you may simply create a new DB connection and use it in standard DB componets (DBInputTable, DBOutputTable, DBExecute). However, you should keep in mind that since the CQL language used by Cassandra is slightly different to other SQL dialects, you will not be able to use all functions of mentioned components - this applies to the following features:

  • Validation might not work in some cases (especially when “append WHERE 1=0” clause is used).

  • Metadata extraction from DB query does not work (validation is required).

  • Browsing DB schema in DB components might not work (you will need to write your CQL query manually).

Regarding the BC connection configuration itself, you will not only need to add the JDBC driver jar file itself but also the other Cassandra JDBC dependencies. Configuration information and links to required JAR files (incl. dependencies) are listed here: https://code.google.com/a/apache-extras … ndra-jdbc/
When loading driver from JAR (green “plus” button), make sure you select all the JAR files (driver and all required dependencies).

On the aforementioned site you can also see format of the URL you need to use in the DB connection wizard (jdbc:cassandra://yourhosts:9160/yourkeyspace).

Hope it helps.

To allow Cassandra to select a contiguous set of rows, the WHERE clause must apply an equality condition to the king component of the primary key. The ALLOW FILTERING clause is also required. ALLOW FILTERING provides the capability to query the clustering columns using any condition.

The thing I love about Cassandra is its writing speed faster than other MySQL’s. Cassandra uses log-structured merge trees for an on-disk format, meaning all writes are done sequentially. That implies a lower write latency. The writes are super fast on Cassandra because it is not searching for something and then writing it, it just writes in a write log and then the rest is taken care by some Cassandra algorithm to actually reflect the update on the table. I came to know about all these after I had my Cassandra lessons which threw a better light on my understanding. :smiley: