Buhake Sindi
Buhake Sindi

Reputation: 89169

Connecting and playing with Cassandra in Java

I have read some tutorials on what Cassandra is and what it can do but my problem is how to interface with Cassandra in java? (A tutorial will be nice :-) )

If possible, can someone please show me whether I should use Thrift or Hector (which one is better and why)?

Thanks in advance.

PS Can I integrate Hibernate with Cassandra?

Upvotes: 6

Views: 18218

Answers (4)

WizardsOfWor
WizardsOfWor

Reputation: 3144

Hibernate OGM looks like it might eventually be the answer.

Upvotes: 2

zznate
zznate

Reputation: 1908

Some example projects using Hector: https://github.com/zznate/cassandra-tutorial https://github.com/zznate/cassandra-stress

Another example (within the actual project) but using using the CQL JDBC driver with our (shiny new) JDBC-pool: https://github.com/riptano/jdbc-conn-pool/tree/master/portfolio-example

Upvotes: 1

JustusTh
JustusTh

Reputation: 183

New for 0.8 is CQL (Cassandra Query Language), an SQL-alike alternative to the traditional RPC interface. Language drivers are available for:

Java (JDBC) Python (DBAPI2) Twisted

http://cassandra.apache.org/download/

http://www.datastax.com/docs/0.8/api/cql_ref

Upvotes: 3

vlood
vlood

Reputation: 927

Hibernate uses JDBC Drivers to connect to relational databases. Cassandra is a ColumnFamily based, which is A relational database (distributed one).

The problem is to find a proper JDBC driver for your case. Here is a project I Googled:

http://code.google.com/p/sql4d/

It's not active currently, but you got the idea of how to find the right one.

Having object-relationship mapping through Hibernate you won't have to worry about the specific dialect Cassandra use and just enjoy the ride.

Well.. that's how it sounds theoretically.

Yet another way is using Pelops library for usage of Cassandra. More info on it HERE.

Getting started with Cassandra - a rather short post on the matter.

Hope you find of your answers there!

Upvotes: 12

Related Questions