DataStax Developer Blog

The native CQL Java driver goes GA

By Jonathan Ellis -  May 9, 2013 | 8 Comments

Today DataStax announces the general availability of the native CQL driver for Java. This is a production-ready driver for Cassandra 1.2+ with no legacy baggage from Thrift or JDBC concepts that don’t translate well to Cassandra.

Highlights include:

  • Full documentation
  • Out-of-the-box best practices for node discovery, load balancing and fail over
  • An asynchronous architecture provides simpler concurrency without any thread pool tuning
  • Tracing support
  • CQL with prepared statements is about 10% faster than Thrift, and we expect that gap to widen as the native protocol matures

More qualitatively but perhaps even more important, this addresses the paradox of choice we’ve had in the Cassandra Java world: multiple driver choices provide another barrier to newcomers, where each must evaluate the options for applicability to his project. Having just done such an evaluation to settle on Cassandra itself, this is the last thing they want to spend time on.

And that’s the best-case scenario. More often, a fragmented landscape leads to many solutions, each of which solve a different 80% of the problem. Better to have a single, well-thought-out solution, that lets people get started writing their application immediately. The native CQL driver provides exactly that.

Get the native CQL driver here. Want to learn more? Check out Patrick McFadin’s talks on data modeling and the new drivers at the 2013 Cassandra Summit, June 11-12. Register today with the code SFSummit25 for a 25% discount, and check out the ten talks I’m most looking forward to.



Comments

  1. Blair Zajac says:

    Congratulations!

    Is there a forum or mailing list to discuss questions, features, implementation details and submitting code in pull requests?

    Regards,
    Blair

  2. Jonathan Ellis says:

    Probably the client dev list — client_dev_subscribe@cassandra.apache.org, with underscores replaced by dashes.

    1. srinivas kadiyala says:

      Mr Ellis,
      I am trying to use the java driver in the MAP_REDUCE code. THe driver is connecting outside using the SIMPLECLIENT. But under mapreduce code I am having issue for connection and the error is in NETTY driver. java.lang.IllegalArgumentException: handler must be either org.jboss.netty.channel.ChannelUpstreamHandler or org.jboss.netty.channel.ChannelDownstreamHandler.
      Could you please give me a few pointers to troubleshoot this issue.

      1. John says:

        I am having the same issue, has anyone managed to resolve this?

  3. For those having trouble getting this to work with JBoss 7, I have got it working on 7.1.1 Final connecting to apache-cassandra 2.0, but I had to jump through a few hoops and try a few things that did not work first. In the end, I could not get it working as part of my EAR deployments, but I could get it working as a jboss module that my ear depended on in its manifest.

    First off, cassandra does not offer a “thin client jar” so this driver depends on all of cassandra for maven to build, but it does not require all of it to run. It was fun trying to determine which jars and jboss module dependencies it needed, but I believe I have it down.

    You should be familiar with building a custom jboss 7 module–don’t worry, it is easy. Basically you make a directory structure com/datastax/driver/core/main inside the modules directory of jboss 7 and create a module.xml to describe the module. The module description tells jboss that it depends on javax and what jars are needed. Below is my module.xml for my datastax java driver module. Hopefully it survives being posted as a comment here.

    As you can see, I got it working by including the following jars:

    cassandra-all-1.2.6.jar
    cassandra-driver-core-1.0.3.jar
    concurrentlinkedhashmap-lru-1.3.jar
    guava-14.0.1.jar
    jackson-core-asl-1.9.2.jar
    jackson-mapper-asl-1.9.2.jar
    libthrift-0.7.0.jar
    metrics-core-2.2.0.jar
    netty-3.6.3.Final.jar
    slf4j-api-1.7.2.jar
    snappy-java-1.0.5.jar

    The process I used was to remove my maven repository cache and do a fresh “package” of the datastax driver, then copy the above jars into the “main” directory of the new jboss module along side the newly built cassandra-driver-core jar. I determined it needed these jars by starting with none and working my way through querying via a test EJB until I was successful without any errors about missing classes etc. I’m hopeful I have found them all, but any others needed can surely be added in the same fashion if I haven’t hit a part of the driver code that needed them in my simple tests.

    In order to use my new datastax module from my ear, I added “com.datastax.driver.core” to my ear’s “Dependencies” in its manifest file. In my case, since my projects are actually built using ant, it was just added to my “ear task” that builds my ear.

    Hope this helps others who are struggling to get this working in JBoss 7.

    Wayne

    1. Well, it appears that the module.xml did not survive being posted, which is unfortunate. The important part of the module.xml was that I named the module com.datastax.driver.core and it had a module dependency on “javax.api” (provided by the jboss container) and all of the aforementioned jars as individual resource-roots. A simple google of how to build jboss 7 modules will get you more examples–it is really quite easy.

    2. Andrey says:

      Hello Wayne. I am struggling with Jboss 7.1 and Cassandra for several days now. I would really appreciate if you share somehow your working module.xml and standalone.xml files. Is it possible?
      Thanks

  4. Nav says:

    Hi – I am using driver version 1.0.3 with cassandra-2.0.0-rc1. I get the following error whenever I try to connect:
    cluster = Cluster.builder().addContactPoint(“127.0.0.1″).build();

    Exception in thread “main” java.lang.NoSuchMethodError: org.apache.cassandra.transport.Connection.(Lorg/apache/cassandra/transport/Connection$Tracker;)V

    Can you please tell me what is wrong?
    Nav

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>