Cassandra Java Client

2014-02-26 Thread Timmy Turner
Hi,

is the DataStax Java Driver for Apache Cassandra (
https://github.com/datastax/java-driver) the official/recommended Java
Client to use for accessing Cassandra from Java?

Does Cassandra itself (i.e. the apache-cassandra-* jars) not contain any
CQL clients?


Thanks!


Re: Cassandra Java Client

2014-02-26 Thread DuyHai Doan
Short answer : yes

Long anwser:  depending on whether you want to access Cassandra using
Thrift of the native CQL3 protocole, different options are available. For
Thrift access, lots of choices (Hector, Astyanax...). For CQL3 right now
the only Java client so far is the one provided by Datastax

Does Cassandra itself (i.e. the apache-cassandra-* jars) not contain any
CQL clients?

 No, the apache jars only ship the server-related components.




On Wed, Feb 26, 2014 at 2:00 PM, Timmy Turner timm.t...@gmail.com wrote:

 Hi,

 is the DataStax Java Driver for Apache Cassandra (
 https://github.com/datastax/java-driver) the official/recommended Java
 Client to use for accessing Cassandra from Java?

 Does Cassandra itself (i.e. the apache-cassandra-* jars) not contain any
 CQL clients?


 Thanks!



Re: Cassandra Java Client

2014-02-26 Thread Vivek Mishra
Kundera does support CQL3. Work for supporting datastax java driver is
under development.

https://github.com/impetus-opensource/Kundera/issues/385

-Vivek


On Wed, Feb 26, 2014 at 6:34 PM, DuyHai Doan doanduy...@gmail.com wrote:

 Short answer : yes

 Long anwser:  depending on whether you want to access Cassandra using
 Thrift of the native CQL3 protocole, different options are available. For
 Thrift access, lots of choices (Hector, Astyanax...). For CQL3 right now
 the only Java client so far is the one provided by Datastax

 Does Cassandra itself (i.e. the apache-cassandra-* jars) not contain any
 CQL clients?

  No, the apache jars only ship the server-related components.




 On Wed, Feb 26, 2014 at 2:00 PM, Timmy Turner timm.t...@gmail.com wrote:

 Hi,

 is the DataStax Java Driver for Apache Cassandra (
 https://github.com/datastax/java-driver) the official/recommended Java
 Client to use for accessing Cassandra from Java?

 Does Cassandra itself (i.e. the apache-cassandra-* jars) not contain any
 CQL clients?


 Thanks!





Re: Hector vs cassandra-java-client

2010-06-24 Thread Ran Tavory
Hector has a pom.xml which and deals with its dependencies as gracefully as
it can, but the problem is that hector's dependencies such as cassandra and
libthrift aren't in public maven repos. Any suggestions how to deal with
that?


On Thu, Jun 24, 2010 at 6:00 AM, Kenneth Bartholet 
kennethbartho...@hotmail.com wrote:

  Agreed, but at what cost?
 It's my understanding that the big deterrent is the lack of 3rd party
 dependencies in maven public repos (e.g. Thrift itself).

 The option would be to publish a public maven repo containing all
 dependencies, which ends up being more responsibility then the client
 developers want to accept.
 Any volunteers?

 -Ken


  To: user@cassandra.apache.org
  From: bbo...@gmail.com

  Subject: Re: Hector vs cassandra-java-client
  Date: Tue, 22 Jun 2010 17:14:53 +0200

 
  Dop Sun su...@dopsun.com writes:
 
   Updated.
 
  the first Cassandra client lib to make it into the Maven repositories
  will probably end up with a big audience. :-)
 
  -Bjørn
 

 --
 Hotmail has tools for the New Busy. Search, chat and e-mail from your
 inbox. Learn 
 more.http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1



Re: Hector vs cassandra-java-client

2010-06-24 Thread Jools
I'm currently using apache archiva instance as a private caching maven
repository. I've manually added the nonpublic artifacts to the cache which
makes life a great deal simpler. See http://archiva.apache.org/

Regards,

--Jools


On 24 June 2010 07:36, Ran Tavory ran...@gmail.com wrote:

 Hector has a pom.xml which and deals with its dependencies as gracefully as
 it can, but the problem is that hector's dependencies such as cassandra and
 libthrift aren't in public maven repos. Any suggestions how to deal with
 that?



 On Thu, Jun 24, 2010 at 6:00 AM, Kenneth Bartholet 
 kennethbartho...@hotmail.com wrote:

  Agreed, but at what cost?
 It's my understanding that the big deterrent is the lack of 3rd party
 dependencies in maven public repos (e.g. Thrift itself).

 The option would be to publish a public maven repo containing all
 dependencies, which ends up being more responsibility then the client
 developers want to accept.
 Any volunteers?

 -Ken


  To: user@cassandra.apache.org
  From: bbo...@gmail.com

  Subject: Re: Hector vs cassandra-java-client
  Date: Tue, 22 Jun 2010 17:14:53 +0200

 
  Dop Sun su...@dopsun.com writes:
 
   Updated.
 
  the first Cassandra client lib to make it into the Maven repositories
  will probably end up with a big audience. :-)
 
  -Bjørn
 

 --
 Hotmail has tools for the New Busy. Search, chat and e-mail from your
 inbox. Learn 
 more.http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1





Re: Hector vs cassandra-java-client

2010-06-24 Thread Jesse McConnell
ya, until the developers decide to go the route of most other apache
projects and use maven and deploy artifacts into maven central your
best bet is to manage it yourself and install into a repository
manager and like archiva and nexus

then you can reference things as normal, just a minor bit of managing
the install of new versions

jesse

--
jesse mcconnell
jesse.mcconn...@gmail.com



On Thu, Jun 24, 2010 at 07:05, Jools jool...@gmail.com wrote:

 I'm currently using apache archiva instance as a private caching maven
 repository. I've manually added the nonpublic artifacts to the cache which
 makes life a great deal simpler. See http://archiva.apache.org/
 Regards,
 --Jools

 On 24 June 2010 07:36, Ran Tavory ran...@gmail.com wrote:

 Hector has a pom.xml which and deals with its dependencies as gracefully
 as it can, but the problem is that hector's dependencies such as cassandra
 and libthrift aren't in public maven repos. Any suggestions how to deal with
 that?


 On Thu, Jun 24, 2010 at 6:00 AM, Kenneth Bartholet
 kennethbartho...@hotmail.com wrote:

 Agreed, but at what cost?
 It's my understanding that the big deterrent is the lack of 3rd party
 dependencies in maven public repos (e.g. Thrift itself).

 The option would be to publish a public maven repo containing all
 dependencies, which ends up being more responsibility then the client
 developers want to accept.
 Any volunteers?

 -Ken

  To: user@cassandra.apache.org
  From: bbo...@gmail.com
  Subject: Re: Hector vs cassandra-java-client
  Date: Tue, 22 Jun 2010 17:14:53 +0200
 
  Dop Sun su...@dopsun.com writes:
 
   Updated.
 
  the first Cassandra client lib to make it into the Maven repositories
  will probably end up with a big audience. :-)
 
  -Bjørn
 

 
 Hotmail has tools for the New Busy. Search, chat and e-mail from your
 inbox. Learn more.




Re: Hector vs cassandra-java-client

2010-06-24 Thread Bjorn Borud
Jesse McConnell jesse.mcconn...@gmail.com writes:

 ya, until the developers decide to go the route of most other apache
 projects and use maven and deploy artifacts into maven central your
 best bet is to manage it yourself and install into a repository
 manager and like archiva and nexus

the issue is a bit worse.  the fact that some key artifacts (such as
Thrift) are not in the official Maven repositories means that projects
end up depending on different versions of these.

for instance, I am in the process of implementing a Thrift service
which is backed by a Cassandra store.  the current assumption is that
I need to hide the dependencies inside OSGi modules so that I can live
with multiple Thrift versions.  (In fact, I've spent all day trying to
figure out how I should go about doing this in the least painful way
possible).

(I was hoping to have an OSGi bundle which embeds all dependencies for
Hector by the end of today, but it seems I have to continue work on
that tomorrow.  What I have so far isn'tpretty :-).


that being said, Thrift has another RC coming up and if this one
sticks we should hopefully see Thrift in the official Maven
repositories soon.  Hopefully Cassandra will follow?

-Bjørn



RE: Hector vs cassandra-java-client

2010-06-23 Thread Kenneth Bartholet

Agreed, but at what cost?
It's my understanding that the big deterrent is the lack of 3rd party 
dependencies in maven public repos (e.g. Thrift itself).

The option would be to publish a public maven repo containing all dependencies, 
which ends up being more responsibility then the client developers want to 
accept.
Any volunteers?

-Ken

 To: user@cassandra.apache.org
 From: bbo...@gmail.com
 Subject: Re: Hector vs cassandra-java-client
 Date: Tue, 22 Jun 2010 17:14:53 +0200
 
 Dop Sun su...@dopsun.com writes:
 
  Updated.
 
 the first Cassandra client lib to make it into the Maven repositories 
 will probably end up with a big audience.  :-)
 
 -Bjørn
 
  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

Re: Hector vs cassandra-java-client

2010-06-22 Thread Bjorn Borud
Dop Sun su...@dopsun.com writes:

 Updated.

the first Cassandra client lib to make it into the Maven repositories 
will probably end up with a big audience.  :-)

-Bjørn



Re: Hector vs cassandra-java-client

2010-05-25 Thread Ran Tavory
cassandra-java-client is up to cassandra's 0.4.2 version, so you probably
can't use it out of the box.
Hector is active and up to the latest 0.6.1 release with a bunch of
committers, contributors and users. See
http://wiki.github.com/rantav/hector/ and
http://groups.google.com/group/hector-users

On Tue, May 25, 2010 at 5:36 AM, Jeff Zhang zjf...@gmail.com wrote:

 I think hector is better, and seems the author of
 cassandra-java-client does not continue work on it.



 On Tue, May 25, 2010 at 10:21 AM, Peter Hsu pe...@motivecast.com wrote:
  Hi All,
 
  This may have been answered already, but I did a [quick] Google search
 and didn't find much.  Which is the better Java client to use?  Hector or
 cassandra-java-client or neither?
 
  it seems Hector is more fully featured and more active as a project in
 general.
 
  What are user experiences with either library?  Any advice?
 
  Thanks,
  Peter



 --
 Best Regards

 Jeff Zhang



RE: Hector vs cassandra-java-client

2010-05-25 Thread Dop Sun
A good chance to introduce my http://code.google.com/p/jassandra/

 

J

 

Another Java client, and well, it cannot be found with Cassandra java client 
keywords. K

 

From: Ran Tavory [mailto:ran...@gmail.com] 
Sent: Tuesday, May 25, 2010 2:52 PM
To: user@cassandra.apache.org
Subject: Re: Hector vs cassandra-java-client

 

cassandra-java-client is up to cassandra's 0.4.2 version, so you probably can't 
use it out of the box.

Hector is active and up to the latest 0.6.1 release with a bunch of committers, 
contributors and users. See http://wiki.github.com/rantav/hector/ and 
http://groups.google.com/group/hector-users

On Tue, May 25, 2010 at 5:36 AM, Jeff Zhang zjf...@gmail.com wrote:

I think hector is better, and seems the author of
cassandra-java-client does not continue work on it.




On Tue, May 25, 2010 at 10:21 AM, Peter Hsu pe...@motivecast.com wrote:
 Hi All,

 This may have been answered already, but I did a [quick] Google search and 
 didn't find much.  Which is the better Java client to use?  Hector or 
 cassandra-java-client or neither?

 it seems Hector is more fully featured and more active as a project in 
 general.

 What are user experiences with either library?  Any advice?

 Thanks,
 Peter




--
Best Regards

Jeff Zhang

 



Re: Hector vs cassandra-java-client

2010-05-25 Thread Maxim Kramarenko

Hello

I've used jassandra, works fine and easy for use.

On 25.05.2010 06:21, Peter Hsu wrote:

Hi All,

This may have been answered already, but I did a [quick] Google search and 
didn't find much.  Which is the better Java client to use?  Hector or 
cassandra-java-client or neither?

it seems Hector is more fully featured and more active as a project in general.

What are user experiences with either library?  Any advice?

Thanks,
Peter




Hector vs cassandra-java-client

2010-05-24 Thread Peter Hsu
Hi All,

This may have been answered already, but I did a [quick] Google search and 
didn't find much.  Which is the better Java client to use?  Hector or 
cassandra-java-client or neither?

it seems Hector is more fully featured and more active as a project in general.

What are user experiences with either library?  Any advice?

Thanks,
Peter

Re: Cassandra Java Client

2010-04-28 Thread Schubert Zhang
I found hector is not a good design.

1. We cannot create multiple threads (each thread have a connection to
cassandra server) to one cassandra server.
As we known, usually, cassandra client should be multiple-threads to
achieve good throughput.

2. The implementation is too fat.

3. Introduce traditional RDBMS habit into Cassandra is not a good idea.


On Wed, Apr 21, 2010 at 1:25 AM, Ran Tavory ran...@gmail.com wrote:

 great, I'm happy you found hector useful and reused it in your client.


 On Tue, Apr 20, 2010 at 5:11 PM, Dop Sun su...@dopsun.com wrote:

  Hi,



 I have downloaded hector-0.6.0-10.jar. As you mentioned, it has good
 implementation for the connection pooling, JMX counters.



 What I’m doing is: using Hector to create the Cassandra client (be
 specific: borrow_client(url, port)). And my understanding is: in this way,
 the Jassandra will enjoy the client pool and JMX counter.



 http://code.google.com/p/jassandra/issues/detail?id=17



 Please feel free to let me know if you have any suggestions.



 The new build 1.0.0 build 3(http://code.google.com/p/jassandra/) created.
 From Jassandra client side, no API changes.



 Cheers~~~

 Dop



 *From:* Ran Tavory [mailto:ran...@gmail.com]
 *Sent:* Tuesday, April 20, 2010 1:36 AM
 *To:* user@cassandra.apache.org
 *Subject:* Re: Cassandra Java Client



 Hi Dop, you may want to look at hector as a low level cassandra client on
 which you build jassandra, adding hibernate style magic etc like other ppl
 have done with ORM layers on top of it.

 Hector's main features include extensive jmx counters, failover and
 connection pooling.

 It's available for all recent versions, including 0.5.0, 0.5.1, 0.6.0 and
 0.6.1

 On Mon, Apr 19, 2010 at 5:58 PM, Dop Sun su...@dopsun.com wrote:

 Well, there are couple of points while Jassandra is created:

 1. First of all, I want to create something like that is because I come
 from
 JDBC background, and familiar with Hibernate API. The ICriteria (which is
 created for querying) is inspired by the Criteria API from hibernate.

 Actually, maybe because of this background, it cost me a lot efforts try
 to
 understand Cassandra in the beginning and Thrift API also takes time to
 use.

 2. The Jassandra creates a layer, which removes the direct link to
 underlying Thrift API (including the exceptions, ConsistencyLevel
 enumeration etc)

 High light this point because I believe the client of the Jassandra will
 benefit for the implementation changes in future, for example, if the
 Cassandra provides better Thrift API to selecting the columns for a list
 of
 keys, SCFs, or deprecating some structures, exceptions, the client may not
 be changed. Of cause, if Jassandra failed to approve itself, this is
 actually not the advantage. :)

 3. The Jassandra is designed to be an JDBC like API, no less, no more. It
 strives to use the best API to do the quering (with token, key, SCF/ CF),
 doing the CRUD, but no more than that. For example, it does not cover any
 API like object mapping. But it should cover all the API functionalities
 Thrift provided.

 These 3 points, are different from Hector (I should be honest that I have
 not tried to use it before, the feeling of difference are coming from the
 sample code Hector provided).

 So, the API Jassandra abstracted was something like this:

IConnection connection = DriverManager.getConnection(
thrift://localhost:9160, info);
try {
  // 2. Get a KeySpace by name
  IKeySpace keySpace = connection.getKeySpace(Keyspace1);

  // 3. Get a ColumnFamily by name
  IColumnFamily cf = keySpace.getColumnFamily(Standard2);

  // 4. Insert like this
  long now = System.currentTimeMillis();
  ByteArray nameFirst = ByteArray.ofASCII(first);
  ByteArray nameLast = ByteArray.ofASCII(last);
  ByteArray nameAge = ByteArray.ofASCII(age);
  ByteArray valueLast = ByteArray.ofUTF8(Smith);
  IColumn colFirst = new Column(nameFirst, ByteArray.ofUTF8(John),
 now);
  cf.insert(userName, colFirst);

  IColumn colLast = new Column(nameLast, valueLast, now);
  cf.insert(userName, colLast);

  IColumn colAge = new Column(nameAge, ByteArray.ofLong(42), now);
  cf.insert(userName, colAge);

  // 5. Select like this
  ICriteria criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName))
  .columnRange(nameAge, nameLast, 10);
  MapString, ListIColumn map = criteria.select();
  ListIColumn list = map.get(userName);
  Assert.assertEquals(3, list.size());
  Assert.assertEquals(valueLast, list.get(2).getValue());

  // 6. Delete like this
  cf.delete(userName, colFirst);
  map = criteria.select();
  Assert.assertEquals(2, map.get(userName).size());

  // 7. Get count like this
  criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName));
  int count = criteria.count();
  Assert.assertEquals(2, count

Re: Cassandra Java Client

2010-04-28 Thread Ran Tavory
Hi Schubert, I'm sorry Hector isn't a good fit for you, so let's see what's
missing for your.

On Thu, Apr 29, 2010 at 8:22 AM, Schubert Zhang zson...@gmail.com wrote:

 I found hector is not a good design.

 1. We cannot create multiple threads (each thread have a connection to
 cassandra server) to one cassandra server.
 As we known, usually, cassandra client should be multiple-threads to
 achieve good throughput.

I usually use hector with many threads, so I'm not sure I understand your
point. Threads and connections are two different things; in hector to obtain
a connection you call borrowClient and then you release the connection by
releaseClient. You may choose to have one connection per thread (I think
it's the simplest way), or many connections per thread. You may also choose
to have many threads using the same connection, but this I think is
less desirable and less scalable. To keep it simple, a good rule of thumb is
connection-per-thread.
Let me know if you have specific design questions and feel free to email
(and join) hector-us...@googlegroups.com


 2. The implementation is too fat.

Feel free to send your diet, improvements and suggestions to
hector-...@googlegroups.com or hector-us...@googlegroups.com


 3. Introduce traditional RDBMS habit into Cassandra is not a good idea.

Which RDBMS habit did you mean?




 On Wed, Apr 21, 2010 at 1:25 AM, Ran Tavory ran...@gmail.com wrote:

 great, I'm happy you found hector useful and reused it in your client.


 On Tue, Apr 20, 2010 at 5:11 PM, Dop Sun su...@dopsun.com wrote:

  Hi,



 I have downloaded hector-0.6.0-10.jar. As you mentioned, it has good
 implementation for the connection pooling, JMX counters.



 What I’m doing is: using Hector to create the Cassandra client (be
 specific: borrow_client(url, port)). And my understanding is: in this way,
 the Jassandra will enjoy the client pool and JMX counter.



 http://code.google.com/p/jassandra/issues/detail?id=17



 Please feel free to let me know if you have any suggestions.



 The new build 1.0.0 build 3(http://code.google.com/p/jassandra/)
 created. From Jassandra client side, no API changes.



 Cheers~~~

 Dop



 *From:* Ran Tavory [mailto:ran...@gmail.com]
 *Sent:* Tuesday, April 20, 2010 1:36 AM
 *To:* user@cassandra.apache.org
 *Subject:* Re: Cassandra Java Client



 Hi Dop, you may want to look at hector as a low level cassandra client on
 which you build jassandra, adding hibernate style magic etc like other ppl
 have done with ORM layers on top of it.

 Hector's main features include extensive jmx counters, failover and
 connection pooling.

 It's available for all recent versions, including 0.5.0, 0.5.1, 0.6.0 and
 0.6.1

 On Mon, Apr 19, 2010 at 5:58 PM, Dop Sun su...@dopsun.com wrote:

 Well, there are couple of points while Jassandra is created:

 1. First of all, I want to create something like that is because I come
 from
 JDBC background, and familiar with Hibernate API. The ICriteria (which is
 created for querying) is inspired by the Criteria API from hibernate.

 Actually, maybe because of this background, it cost me a lot efforts try
 to
 understand Cassandra in the beginning and Thrift API also takes time to
 use.

 2. The Jassandra creates a layer, which removes the direct link to
 underlying Thrift API (including the exceptions, ConsistencyLevel
 enumeration etc)

 High light this point because I believe the client of the Jassandra will
 benefit for the implementation changes in future, for example, if the
 Cassandra provides better Thrift API to selecting the columns for a list
 of
 keys, SCFs, or deprecating some structures, exceptions, the client may
 not
 be changed. Of cause, if Jassandra failed to approve itself, this is
 actually not the advantage. :)

 3. The Jassandra is designed to be an JDBC like API, no less, no more. It
 strives to use the best API to do the quering (with token, key, SCF/ CF),
 doing the CRUD, but no more than that. For example, it does not cover any
 API like object mapping. But it should cover all the API functionalities
 Thrift provided.

 These 3 points, are different from Hector (I should be honest that I have
 not tried to use it before, the feeling of difference are coming from the
 sample code Hector provided).

 So, the API Jassandra abstracted was something like this:

IConnection connection = DriverManager.getConnection(
thrift://localhost:9160, info);
try {
  // 2. Get a KeySpace by name
  IKeySpace keySpace = connection.getKeySpace(Keyspace1);

  // 3. Get a ColumnFamily by name
  IColumnFamily cf = keySpace.getColumnFamily(Standard2);

  // 4. Insert like this
  long now = System.currentTimeMillis();
  ByteArray nameFirst = ByteArray.ofASCII(first);
  ByteArray nameLast = ByteArray.ofASCII(last);
  ByteArray nameAge = ByteArray.ofASCII(age);
  ByteArray valueLast = ByteArray.ofUTF8(Smith);
  IColumn colFirst = new Column(nameFirst, ByteArray.ofUTF8(John

RE: Cassandra Java Client

2010-04-20 Thread Dop Sun
Hi,

 

I have downloaded hector-0.6.0-10.jar. As you mentioned, it has good 
implementation for the connection pooling, JMX counters.

 

What I’m doing is: using Hector to create the Cassandra client (be specific: 
borrow_client(url, port)). And my understanding is: in this way, the Jassandra 
will enjoy the client pool and JMX counter.

 

http://code.google.com/p/jassandra/issues/detail?id=17

 

Please feel free to let me know if you have any suggestions.

 

The new build 1.0.0 build 3(http://code.google.com/p/jassandra/) created. From 
Jassandra client side, no API changes.

 

Cheers~~~

Dop

 

From: Ran Tavory [mailto:ran...@gmail.com] 
Sent: Tuesday, April 20, 2010 1:36 AM
To: user@cassandra.apache.org
Subject: Re: Cassandra Java Client

 

Hi Dop, you may want to look at hector as a low level cassandra client on which 
you build jassandra, adding hibernate style magic etc like other ppl have done 
with ORM layers on top of it.

Hector's main features include extensive jmx counters, failover and connection 
pooling. 

It's available for all recent versions, including 0.5.0, 0.5.1, 0.6.0 and 0.6.1

On Mon, Apr 19, 2010 at 5:58 PM, Dop Sun su...@dopsun.com wrote:

Well, there are couple of points while Jassandra is created:

1. First of all, I want to create something like that is because I come from
JDBC background, and familiar with Hibernate API. The ICriteria (which is
created for querying) is inspired by the Criteria API from hibernate.

Actually, maybe because of this background, it cost me a lot efforts try to
understand Cassandra in the beginning and Thrift API also takes time to use.

2. The Jassandra creates a layer, which removes the direct link to
underlying Thrift API (including the exceptions, ConsistencyLevel
enumeration etc)

High light this point because I believe the client of the Jassandra will
benefit for the implementation changes in future, for example, if the
Cassandra provides better Thrift API to selecting the columns for a list of
keys, SCFs, or deprecating some structures, exceptions, the client may not
be changed. Of cause, if Jassandra failed to approve itself, this is
actually not the advantage. :)

3. The Jassandra is designed to be an JDBC like API, no less, no more. It
strives to use the best API to do the quering (with token, key, SCF/ CF),
doing the CRUD, but no more than that. For example, it does not cover any
API like object mapping. But it should cover all the API functionalities
Thrift provided.

These 3 points, are different from Hector (I should be honest that I have
not tried to use it before, the feeling of difference are coming from the
sample code Hector provided).

So, the API Jassandra abstracted was something like this:

   IConnection connection = DriverManager.getConnection(
   thrift://localhost:9160, info);
   try {
 // 2. Get a KeySpace by name
 IKeySpace keySpace = connection.getKeySpace(Keyspace1);

 // 3. Get a ColumnFamily by name
 IColumnFamily cf = keySpace.getColumnFamily(Standard2);

 // 4. Insert like this
 long now = System.currentTimeMillis();
 ByteArray nameFirst = ByteArray.ofASCII(first);
 ByteArray nameLast = ByteArray.ofASCII(last);
 ByteArray nameAge = ByteArray.ofASCII(age);
 ByteArray valueLast = ByteArray.ofUTF8(Smith);
 IColumn colFirst = new Column(nameFirst, ByteArray.ofUTF8(John),
now);
 cf.insert(userName, colFirst);

 IColumn colLast = new Column(nameLast, valueLast, now);
 cf.insert(userName, colLast);

 IColumn colAge = new Column(nameAge, ByteArray.ofLong(42), now);
 cf.insert(userName, colAge);

 // 5. Select like this
 ICriteria criteria = cf.createCriteria();
 criteria.keyList(Lists.newArrayList(userName))
 .columnRange(nameAge, nameLast, 10);
 MapString, ListIColumn map = criteria.select();
 ListIColumn list = map.get(userName);
 Assert.assertEquals(3, list.size());
 Assert.assertEquals(valueLast, list.get(2).getValue());

 // 6. Delete like this
 cf.delete(userName, colFirst);
 map = criteria.select();
 Assert.assertEquals(2, map.get(userName).size());

 // 7. Get count like this
 criteria = cf.createCriteria();
 criteria.keyList(Lists.newArrayList(userName));
 int count = criteria.count();
 Assert.assertEquals(2, count);
   } finally {
 // 8. Don't forget to close the connection.
 connection.close();

   }
 }

-Original Message-
From: Jonathan Ellis [mailto:jbel...@gmail.com]
Sent: Monday, April 19, 2010 10:35 PM
To: user@cassandra.apache.org

Subject: Re: Cassandra Java Client

How is Jassandra different from http://github.com/rantav/hector ?

On Mon, Apr 19, 2010 at 9:21 AM, Dop Sun su...@dopsun.com wrote:
 May I take this chance to share this link here:

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



 It currently based with Cassandra 0.6 Thrift APIs.



 The class ThriftCriteria and ThriftColumnFamily has direct use of Thrift
 API. Also, the site itself has

Re: Cassandra Java Client

2010-04-20 Thread Nathan McCall
Dop,
Thank you for trying out hector. I think you have the right approach
for using it with your project. Feel free to ping us directly
regarding Hector on either of these mailings lists as appropriate:
http://wiki.github.com/rantav/hector/mailing-lists

Cheers,
-Nate

On Tue, Apr 20, 2010 at 7:11 AM, Dop Sun su...@dopsun.com wrote:
 Hi,



 I have downloaded hector-0.6.0-10.jar. As you mentioned, it has good
 implementation for the connection pooling, JMX counters.



 What I’m doing is: using Hector to create the Cassandra client (be specific:
 borrow_client(url, port)). And my understanding is: in this way, the
 Jassandra will enjoy the client pool and JMX counter.



 http://code.google.com/p/jassandra/issues/detail?id=17



 Please feel free to let me know if you have any suggestions.



 The new build 1.0.0 build 3(http://code.google.com/p/jassandra/) created.
 From Jassandra client side, no API changes.



 Cheers~~~

 Dop



 From: Ran Tavory [mailto:ran...@gmail.com]
 Sent: Tuesday, April 20, 2010 1:36 AM
 To: user@cassandra.apache.org
 Subject: Re: Cassandra Java Client



 Hi Dop, you may want to look at hector as a low level cassandra client on
 which you build jassandra, adding hibernate style magic etc like other ppl
 have done with ORM layers on top of it.

 Hector's main features include extensive jmx counters, failover and
 connection pooling.

 It's available for all recent versions, including 0.5.0, 0.5.1, 0.6.0 and
 0.6.1

 On Mon, Apr 19, 2010 at 5:58 PM, Dop Sun su...@dopsun.com wrote:

 Well, there are couple of points while Jassandra is created:

 1. First of all, I want to create something like that is because I come from
 JDBC background, and familiar with Hibernate API. The ICriteria (which is
 created for querying) is inspired by the Criteria API from hibernate.

 Actually, maybe because of this background, it cost me a lot efforts try to
 understand Cassandra in the beginning and Thrift API also takes time to use.

 2. The Jassandra creates a layer, which removes the direct link to
 underlying Thrift API (including the exceptions, ConsistencyLevel
 enumeration etc)

 High light this point because I believe the client of the Jassandra will
 benefit for the implementation changes in future, for example, if the
 Cassandra provides better Thrift API to selecting the columns for a list of
 keys, SCFs, or deprecating some structures, exceptions, the client may not
 be changed. Of cause, if Jassandra failed to approve itself, this is
 actually not the advantage. :)

 3. The Jassandra is designed to be an JDBC like API, no less, no more. It
 strives to use the best API to do the quering (with token, key, SCF/ CF),
 doing the CRUD, but no more than that. For example, it does not cover any
 API like object mapping. But it should cover all the API functionalities
 Thrift provided.

 These 3 points, are different from Hector (I should be honest that I have
 not tried to use it before, the feeling of difference are coming from the
 sample code Hector provided).

 So, the API Jassandra abstracted was something like this:

    IConnection connection = DriverManager.getConnection(
        thrift://localhost:9160, info);
    try {
      // 2. Get a KeySpace by name
      IKeySpace keySpace = connection.getKeySpace(Keyspace1);

      // 3. Get a ColumnFamily by name
      IColumnFamily cf = keySpace.getColumnFamily(Standard2);

      // 4. Insert like this
      long now = System.currentTimeMillis();
      ByteArray nameFirst = ByteArray.ofASCII(first);
      ByteArray nameLast = ByteArray.ofASCII(last);
      ByteArray nameAge = ByteArray.ofASCII(age);
      ByteArray valueLast = ByteArray.ofUTF8(Smith);
      IColumn colFirst = new Column(nameFirst, ByteArray.ofUTF8(John),
 now);
      cf.insert(userName, colFirst);

      IColumn colLast = new Column(nameLast, valueLast, now);
      cf.insert(userName, colLast);

      IColumn colAge = new Column(nameAge, ByteArray.ofLong(42), now);
      cf.insert(userName, colAge);

      // 5. Select like this
      ICriteria criteria = cf.createCriteria();
      criteria.keyList(Lists.newArrayList(userName))
          .columnRange(nameAge, nameLast, 10);
      MapString, ListIColumn map = criteria.select();
      ListIColumn list = map.get(userName);
      Assert.assertEquals(3, list.size());
      Assert.assertEquals(valueLast, list.get(2).getValue());

      // 6. Delete like this
      cf.delete(userName, colFirst);
      map = criteria.select();
      Assert.assertEquals(2, map.get(userName).size());

      // 7. Get count like this
      criteria = cf.createCriteria();
      criteria.keyList(Lists.newArrayList(userName));
      int count = criteria.count();
      Assert.assertEquals(2, count);
    } finally {
      // 8. Don't forget to close the connection.
      connection.close();

    }
  }

 -Original Message-
 From: Jonathan Ellis [mailto:jbel...@gmail.com]
 Sent: Monday, April 19, 2010 10:35 PM
 To: user@cassandra.apache.org

 Subject

Re: Cassandra Java Client

2010-04-20 Thread Ran Tavory
great, I'm happy you found hector useful and reused it in your client.

On Tue, Apr 20, 2010 at 5:11 PM, Dop Sun su...@dopsun.com wrote:

  Hi,



 I have downloaded hector-0.6.0-10.jar. As you mentioned, it has good
 implementation for the connection pooling, JMX counters.



 What I’m doing is: using Hector to create the Cassandra client (be
 specific: borrow_client(url, port)). And my understanding is: in this way,
 the Jassandra will enjoy the client pool and JMX counter.



 http://code.google.com/p/jassandra/issues/detail?id=17



 Please feel free to let me know if you have any suggestions.



 The new build 1.0.0 build 3(http://code.google.com/p/jassandra/) created.
 From Jassandra client side, no API changes.



 Cheers~~~

 Dop



 *From:* Ran Tavory [mailto:ran...@gmail.com]
 *Sent:* Tuesday, April 20, 2010 1:36 AM
 *To:* user@cassandra.apache.org
 *Subject:* Re: Cassandra Java Client



 Hi Dop, you may want to look at hector as a low level cassandra client on
 which you build jassandra, adding hibernate style magic etc like other ppl
 have done with ORM layers on top of it.

 Hector's main features include extensive jmx counters, failover and
 connection pooling.

 It's available for all recent versions, including 0.5.0, 0.5.1, 0.6.0 and
 0.6.1

 On Mon, Apr 19, 2010 at 5:58 PM, Dop Sun su...@dopsun.com wrote:

 Well, there are couple of points while Jassandra is created:

 1. First of all, I want to create something like that is because I come
 from
 JDBC background, and familiar with Hibernate API. The ICriteria (which is
 created for querying) is inspired by the Criteria API from hibernate.

 Actually, maybe because of this background, it cost me a lot efforts try to
 understand Cassandra in the beginning and Thrift API also takes time to
 use.

 2. The Jassandra creates a layer, which removes the direct link to
 underlying Thrift API (including the exceptions, ConsistencyLevel
 enumeration etc)

 High light this point because I believe the client of the Jassandra will
 benefit for the implementation changes in future, for example, if the
 Cassandra provides better Thrift API to selecting the columns for a list of
 keys, SCFs, or deprecating some structures, exceptions, the client may not
 be changed. Of cause, if Jassandra failed to approve itself, this is
 actually not the advantage. :)

 3. The Jassandra is designed to be an JDBC like API, no less, no more. It
 strives to use the best API to do the quering (with token, key, SCF/ CF),
 doing the CRUD, but no more than that. For example, it does not cover any
 API like object mapping. But it should cover all the API functionalities
 Thrift provided.

 These 3 points, are different from Hector (I should be honest that I have
 not tried to use it before, the feeling of difference are coming from the
 sample code Hector provided).

 So, the API Jassandra abstracted was something like this:

IConnection connection = DriverManager.getConnection(
thrift://localhost:9160, info);
try {
  // 2. Get a KeySpace by name
  IKeySpace keySpace = connection.getKeySpace(Keyspace1);

  // 3. Get a ColumnFamily by name
  IColumnFamily cf = keySpace.getColumnFamily(Standard2);

  // 4. Insert like this
  long now = System.currentTimeMillis();
  ByteArray nameFirst = ByteArray.ofASCII(first);
  ByteArray nameLast = ByteArray.ofASCII(last);
  ByteArray nameAge = ByteArray.ofASCII(age);
  ByteArray valueLast = ByteArray.ofUTF8(Smith);
  IColumn colFirst = new Column(nameFirst, ByteArray.ofUTF8(John),
 now);
  cf.insert(userName, colFirst);

  IColumn colLast = new Column(nameLast, valueLast, now);
  cf.insert(userName, colLast);

  IColumn colAge = new Column(nameAge, ByteArray.ofLong(42), now);
  cf.insert(userName, colAge);

  // 5. Select like this
  ICriteria criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName))
  .columnRange(nameAge, nameLast, 10);
  MapString, ListIColumn map = criteria.select();
  ListIColumn list = map.get(userName);
  Assert.assertEquals(3, list.size());
  Assert.assertEquals(valueLast, list.get(2).getValue());

  // 6. Delete like this
  cf.delete(userName, colFirst);
  map = criteria.select();
  Assert.assertEquals(2, map.get(userName).size());

  // 7. Get count like this
  criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName));
  int count = criteria.count();
  Assert.assertEquals(2, count);
} finally {
  // 8. Don't forget to close the connection.
  connection.close();

}
  }

 -Original Message-
 From: Jonathan Ellis [mailto:jbel...@gmail.com]
 Sent: Monday, April 19, 2010 10:35 PM
 To: user@cassandra.apache.org

 Subject: Re: Cassandra Java Client

 How is Jassandra different from http://github.com/rantav/hector ?

 On Mon, Apr 19, 2010 at 9:21 AM, Dop Sun su...@dopsun.com wrote:
  May I take

RE: Cassandra Java Client

2010-04-19 Thread Dop Sun
May I take this chance to share this link here:

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

 

It currently based with Cassandra 0.6 Thrift APIs.

 

The class ThriftCriteria and ThriftColumnFamily has direct use of Thrift
API. Also, the site itself has test code, which is actually works on
Jassandra abstraction.

 

Dop 

 

From: Nirmala Agadgar [mailto:nirmala...@gmail.com] 
Sent: Friday, April 16, 2010 5:56 PM
To: user@cassandra.apache.org
Subject: Cassandra Java Client

 

Hi,

Can anyone tell how to implement Client that can insert data into cassandra
in Java. Any Code or guidelines would be helpful.

-
Nirmala
 



Re: Cassandra Java Client

2010-04-19 Thread Jonathan Ellis
How is Jassandra different from http://github.com/rantav/hector ?

On Mon, Apr 19, 2010 at 9:21 AM, Dop Sun su...@dopsun.com wrote:
 May I take this chance to share this link here:

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



 It currently based with Cassandra 0.6 Thrift APIs.



 The class ThriftCriteria and ThriftColumnFamily has direct use of Thrift
 API. Also, the site itself has test code, which is actually works on
 Jassandra abstraction.



 Dop



 From: Nirmala Agadgar [mailto:nirmala...@gmail.com]
 Sent: Friday, April 16, 2010 5:56 PM
 To: user@cassandra.apache.org
 Subject: Cassandra Java Client



 Hi,

 Can anyone tell how to implement Client that can insert data into cassandra
 in Java. Any Code or guidelines would be helpful.

 -
 Nirmala



RE: Cassandra Java Client

2010-04-19 Thread Dop Sun
Well, there are couple of points while Jassandra is created:

1. First of all, I want to create something like that is because I come from
JDBC background, and familiar with Hibernate API. The ICriteria (which is
created for querying) is inspired by the Criteria API from hibernate.

Actually, maybe because of this background, it cost me a lot efforts try to
understand Cassandra in the beginning and Thrift API also takes time to use.

2. The Jassandra creates a layer, which removes the direct link to
underlying Thrift API (including the exceptions, ConsistencyLevel
enumeration etc)

High light this point because I believe the client of the Jassandra will
benefit for the implementation changes in future, for example, if the
Cassandra provides better Thrift API to selecting the columns for a list of
keys, SCFs, or deprecating some structures, exceptions, the client may not
be changed. Of cause, if Jassandra failed to approve itself, this is
actually not the advantage. :)

3. The Jassandra is designed to be an JDBC like API, no less, no more. It
strives to use the best API to do the quering (with token, key, SCF/ CF),
doing the CRUD, but no more than that. For example, it does not cover any
API like object mapping. But it should cover all the API functionalities
Thrift provided.

These 3 points, are different from Hector (I should be honest that I have
not tried to use it before, the feeling of difference are coming from the
sample code Hector provided).

So, the API Jassandra abstracted was something like this:

IConnection connection = DriverManager.getConnection(
thrift://localhost:9160, info);
try {
  // 2. Get a KeySpace by name
  IKeySpace keySpace = connection.getKeySpace(Keyspace1);

  // 3. Get a ColumnFamily by name
  IColumnFamily cf = keySpace.getColumnFamily(Standard2);

  // 4. Insert like this
  long now = System.currentTimeMillis();
  ByteArray nameFirst = ByteArray.ofASCII(first);
  ByteArray nameLast = ByteArray.ofASCII(last);
  ByteArray nameAge = ByteArray.ofASCII(age);
  ByteArray valueLast = ByteArray.ofUTF8(Smith);
  IColumn colFirst = new Column(nameFirst, ByteArray.ofUTF8(John),
now);
  cf.insert(userName, colFirst);

  IColumn colLast = new Column(nameLast, valueLast, now);
  cf.insert(userName, colLast);

  IColumn colAge = new Column(nameAge, ByteArray.ofLong(42), now);
  cf.insert(userName, colAge);

  // 5. Select like this
  ICriteria criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName))
  .columnRange(nameAge, nameLast, 10);
  MapString, ListIColumn map = criteria.select();
  ListIColumn list = map.get(userName);
  Assert.assertEquals(3, list.size());
  Assert.assertEquals(valueLast, list.get(2).getValue());

  // 6. Delete like this
  cf.delete(userName, colFirst);
  map = criteria.select();
  Assert.assertEquals(2, map.get(userName).size());

  // 7. Get count like this
  criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName));
  int count = criteria.count();
  Assert.assertEquals(2, count);
} finally {
  // 8. Don't forget to close the connection.
  connection.close();
}
  }

-Original Message-
From: Jonathan Ellis [mailto:jbel...@gmail.com] 
Sent: Monday, April 19, 2010 10:35 PM
To: user@cassandra.apache.org
Subject: Re: Cassandra Java Client

How is Jassandra different from http://github.com/rantav/hector ?

On Mon, Apr 19, 2010 at 9:21 AM, Dop Sun su...@dopsun.com wrote:
 May I take this chance to share this link here:

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



 It currently based with Cassandra 0.6 Thrift APIs.



 The class ThriftCriteria and ThriftColumnFamily has direct use of Thrift
 API. Also, the site itself has test code, which is actually works on
 Jassandra abstraction.



 Dop



 From: Nirmala Agadgar [mailto:nirmala...@gmail.com]
 Sent: Friday, April 16, 2010 5:56 PM
 To: user@cassandra.apache.org
 Subject: Cassandra Java Client



 Hi,

 Can anyone tell how to implement Client that can insert data into
cassandra
 in Java. Any Code or guidelines would be helpful.

 -
 Nirmala





Re: Cassandra Java Client

2010-04-19 Thread Ran Tavory
Hi Dop, you may want to look at hector as a low level cassandra client on
which you build jassandra, adding hibernate style magic etc like other ppl
have done with ORM layers on top of it.
Hector's main features include extensive jmx counters, failover and
connection pooling.
It's available for all recent versions, including 0.5.0, 0.5.1, 0.6.0 and
0.6.1

On Mon, Apr 19, 2010 at 5:58 PM, Dop Sun su...@dopsun.com wrote:

 Well, there are couple of points while Jassandra is created:

 1. First of all, I want to create something like that is because I come
 from
 JDBC background, and familiar with Hibernate API. The ICriteria (which is
 created for querying) is inspired by the Criteria API from hibernate.

 Actually, maybe because of this background, it cost me a lot efforts try to
 understand Cassandra in the beginning and Thrift API also takes time to
 use.

 2. The Jassandra creates a layer, which removes the direct link to
 underlying Thrift API (including the exceptions, ConsistencyLevel
 enumeration etc)

 High light this point because I believe the client of the Jassandra will
 benefit for the implementation changes in future, for example, if the
 Cassandra provides better Thrift API to selecting the columns for a list of
 keys, SCFs, or deprecating some structures, exceptions, the client may not
 be changed. Of cause, if Jassandra failed to approve itself, this is
 actually not the advantage. :)

 3. The Jassandra is designed to be an JDBC like API, no less, no more. It
 strives to use the best API to do the quering (with token, key, SCF/ CF),
 doing the CRUD, but no more than that. For example, it does not cover any
 API like object mapping. But it should cover all the API functionalities
 Thrift provided.

 These 3 points, are different from Hector (I should be honest that I have
 not tried to use it before, the feeling of difference are coming from the
 sample code Hector provided).

 So, the API Jassandra abstracted was something like this:

IConnection connection = DriverManager.getConnection(
thrift://localhost:9160, info);
try {
  // 2. Get a KeySpace by name
  IKeySpace keySpace = connection.getKeySpace(Keyspace1);

  // 3. Get a ColumnFamily by name
  IColumnFamily cf = keySpace.getColumnFamily(Standard2);

  // 4. Insert like this
  long now = System.currentTimeMillis();
  ByteArray nameFirst = ByteArray.ofASCII(first);
  ByteArray nameLast = ByteArray.ofASCII(last);
  ByteArray nameAge = ByteArray.ofASCII(age);
  ByteArray valueLast = ByteArray.ofUTF8(Smith);
  IColumn colFirst = new Column(nameFirst, ByteArray.ofUTF8(John),
 now);
  cf.insert(userName, colFirst);

  IColumn colLast = new Column(nameLast, valueLast, now);
  cf.insert(userName, colLast);

  IColumn colAge = new Column(nameAge, ByteArray.ofLong(42), now);
  cf.insert(userName, colAge);

  // 5. Select like this
  ICriteria criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName))
  .columnRange(nameAge, nameLast, 10);
  MapString, ListIColumn map = criteria.select();
  ListIColumn list = map.get(userName);
  Assert.assertEquals(3, list.size());
  Assert.assertEquals(valueLast, list.get(2).getValue());

  // 6. Delete like this
  cf.delete(userName, colFirst);
  map = criteria.select();
  Assert.assertEquals(2, map.get(userName).size());

  // 7. Get count like this
  criteria = cf.createCriteria();
  criteria.keyList(Lists.newArrayList(userName));
  int count = criteria.count();
  Assert.assertEquals(2, count);
} finally {
  // 8. Don't forget to close the connection.
  connection.close();
 }
  }

 -Original Message-
 From: Jonathan Ellis [mailto:jbel...@gmail.com]
 Sent: Monday, April 19, 2010 10:35 PM
 To: user@cassandra.apache.org
 Subject: Re: Cassandra Java Client

 How is Jassandra different from http://github.com/rantav/hector ?

 On Mon, Apr 19, 2010 at 9:21 AM, Dop Sun su...@dopsun.com wrote:
  May I take this chance to share this link here:
 
  http://code.google.com/p/jassandra/
 
 
 
  It currently based with Cassandra 0.6 Thrift APIs.
 
 
 
  The class ThriftCriteria and ThriftColumnFamily has direct use of Thrift
  API. Also, the site itself has test code, which is actually works on
  Jassandra abstraction.
 
 
 
  Dop
 
 
 
  From: Nirmala Agadgar [mailto:nirmala...@gmail.com]
  Sent: Friday, April 16, 2010 5:56 PM
  To: user@cassandra.apache.org
  Subject: Cassandra Java Client
 
 
 
  Hi,
 
  Can anyone tell how to implement Client that can insert data into
 cassandra
  in Java. Any Code or guidelines would be helpful.
 
  -
  Nirmala
 





RE: Cassandra Java Client

2010-04-19 Thread Dop Sun
Hi Ran:

 

Yep, looks like there is possibility that I can add dependencies to hector, and 
enhance the functionality to Jassandra.

 

I would take this chance to extend the discussion about “xxx Client for 
Cassandra” a little bit:

 

In short, Cassandra may need a kind of sub-project to define the “xxx-client 
for Cassandra” for most of the popular platforms (like Python, Java, .NET), or, 
it defines a framework (standard, guideline, or whatever), and let the 
community to port/ implement in different language/ platform. 

 

I believe Cassandra product itself needs the flexibility to change Thrift API 
at any given time, including deprecating the old API, which may have bad 
performance, or adding new API to cover new functionality, but the production 
deployed applications build on Cassandra in general (in general, means not the 
company like FaceBook, Digg, who has huge team to follow the changes of 
Cassandra) cannot bear this. And if these products depend on the Thrift API, 
which means eventually, these deployment will be left behind with old version.

 

This problem happens in RDBMS world, and eventually, it’s resolved with xDBC 
APIs. The new database coming out, it provides the general features + special 
features. So, the applications built on database technologies, in most of the 
cases, can move smoothly to the latest database server versions.

 

With another layer of abstraction, the performance of the application does not 
necessarily to be slower, since the newly introduced API developer, can try to 
use the latest version of the Thrift API to provide the best performance for 
the requests of the application. An immediate example would be: in the Thrift 
API, the querying API (get_xxx, mult_get, and get_key_slice) has been enhanced 
a lot. For the application, before “xxx-client for Cassandra” updated, it can 
work with new version of Cassandra with using the old API. And once the 
“xxx-client” updated, it will immediately using the new features even without 
change the application codes.

 

The reason I believe this “xxx-client for Cassandra” best to be a sub-project, 
because since the API of Cassandra is changing, at this stage, the design of 
such an API need lot of inside details/ guide. It’s very difficult for people 
from outside, like me, to define some API based on guessing, which may 
eventually can be flexible enough to support feature Cassandra. I can see 
several “xxx client for Cassandra” project eventually abandoned, and my guess 
is because of this. Maybe one day, Jassandra also cannot be further extended to 
meet the new API of future version of Cassandra, and I may abandon it as well. J

 

Cheers~~~

Dop 

 

From: Ran Tavory [mailto:ran...@gmail.com] 
Sent: Tuesday, April 20, 2010 1:36 AM
To: user@cassandra.apache.org
Subject: Re: Cassandra Java Client

 

Hi Dop, you may want to look at hector as a low level cassandra client on which 
you build jassandra, adding hibernate style magic etc like other ppl have done 
with ORM layers on top of it.

Hector's main features include extensive jmx counters, failover and connection 
pooling. 

It's available for all recent versions, including 0.5.0, 0.5.1, 0.6.0 and 0.6.1

On Mon, Apr 19, 2010 at 5:58 PM, Dop Sun su...@dopsun.com wrote:

Well, there are couple of points while Jassandra is created:

1. First of all, I want to create something like that is because I come from
JDBC background, and familiar with Hibernate API. The ICriteria (which is
created for querying) is inspired by the Criteria API from hibernate.

Actually, maybe because of this background, it cost me a lot efforts try to
understand Cassandra in the beginning and Thrift API also takes time to use.

2. The Jassandra creates a layer, which removes the direct link to
underlying Thrift API (including the exceptions, ConsistencyLevel
enumeration etc)

High light this point because I believe the client of the Jassandra will
benefit for the implementation changes in future, for example, if the
Cassandra provides better Thrift API to selecting the columns for a list of
keys, SCFs, or deprecating some structures, exceptions, the client may not
be changed. Of cause, if Jassandra failed to approve itself, this is
actually not the advantage. :)

3. The Jassandra is designed to be an JDBC like API, no less, no more. It
strives to use the best API to do the quering (with token, key, SCF/ CF),
doing the CRUD, but no more than that. For example, it does not cover any
API like object mapping. But it should cover all the API functionalities
Thrift provided.

These 3 points, are different from Hector (I should be honest that I have
not tried to use it before, the feeling of difference are coming from the
sample code Hector provided).

So, the API Jassandra abstracted was something like this:

   IConnection connection = DriverManager.getConnection(
   thrift://localhost:9160, info);
   try {
 // 2. Get a KeySpace by name
 IKeySpace keySpace

Cassandra Java Client

2010-04-16 Thread Nirmala Agadgar
Hi,

Can anyone tell how to implement Client that can insert data into cassandra
in Java. Any Code or guidelines would be helpful.

-
Nirmala


Re: Cassandra Java Client

2010-04-16 Thread Colin Vipurs
Take a look at Hector, a Java client:

http://wiki.github.com/rantav/hector/

There's example code here:

http://github.com/rantav/hector/blob/master/src/main/java/me/prettyprint/cassandra/service/ExampleClient.java

On Fri, Apr 16, 2010 at 10:56 AM, Nirmala Agadgar nirmala...@gmail.com wrote:
 Hi,

 Can anyone tell how to implement Client that can insert data into cassandra
 in Java. Any Code or guidelines would be helpful.

 -
 Nirmala





-- 
Maybe she awoke to see the roommate's boyfriend swinging from the
chandelier wearing a boar's head.

Something which you, I, and everyone else would call Tuesday, of course.


RE: Cassandra Java Client

2010-04-16 Thread Ake Tangkananond
Hi Nirmala,

 

Welcome to Cassandra! Is this the one you are looking for ?

http://www.sodeso.nl/?p=80

 

 

-Ake

 

From: Nirmala Agadgar [mailto:nirmala...@gmail.com] 
Sent: Friday, April 16, 2010 4:56 PM
To: user@cassandra.apache.org
Subject: Cassandra Java Client

 

Hi,

Can anyone tell how to implement Client that can insert data into cassandra
in Java. Any Code or guidelines would be helpful.

-
Nirmala
 



Re: Cassandra Java Client

2010-04-16 Thread Linton N
import java.util.List;
import java.io.UnsupportedEncodingException;

import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.TException;
import org.apache.cassandra.service.*;

public class CClient
{
public static void main(String[] args)
throws TException, InvalidRequestException, UnavailableException,
UnsupportedEncodingException, NotFoundException
{
TTransport tr = new TSocket(localhost, 9160);
TProtocol proto = new TBinaryProtocol(tr);
Cassandra.Client client = new Cassandra.Client(proto);
tr.open();

String key_user_id = 1;

// insert data
long timestamp = System.currentTimeMillis();
client.insert(Keyspace1,
  key_user_id,
  new ColumnPath(Standard1, null,
name.getBytes(UTF-8)),
  Chris Goffinet.getBytes(UTF-8),
  timestamp,
  ConsistencyLevel.ONE);
client.insert(Keyspace1,
  key_user_id,
  new ColumnPath(Standard1, null,
age.getBytes(UTF-8)),
  24.getBytes(UTF-8),
  timestamp,
  ConsistencyLevel.ONE);

// read single column
ColumnPath path = new ColumnPath(Standard1, null,
name.getBytes(UTF-8));
System.out.println(client.get(Keyspace1, key_user_id, path,
ConsistencyLevel.ONE));

// read entire row
SlicePredicate predicate = new SlicePredicate(null, new
SliceRange(new byte[0], new byte[0], false, 10));
ColumnParent parent = new ColumnParent(Standard1, null);
ListColumnOrSuperColumn results =
client.get_slice(Keyspace1, key_user_id, parent, predicate,
ConsistencyLevel.ONE);
for (ColumnOrSuperColumn result : results)
{
Column column = result.column;
System.out.println(new String(column.name, UTF-8) +  -
 + new String(column.value, UTF-8));
}

tr.close();
}
}





On Fri, Apr 16, 2010 at 3:26 PM, Nirmala Agadgar nirmala...@gmail.comwrote:

 Hi,

 Can anyone tell how to implement Client that can insert data into cassandra
 in Java. Any Code or guidelines would be helpful.

 -
 Nirmala





-- 
--
With Love
 Lin N