email iconemail phone iconcall

C++ Driver for Cassandra Open Sourced!

By Michael Figuiere -  November 5, 2013 | 12 Comments

I'm glad to announce that we open source today our C++ Driver for Apache Cassandra, following our plan to bring a simple and modern API for Cassandra to major programming languages. Just like our Java Driver, C# Driver and Python Driver, this C++ Driver targets Cassandra 1.2+ as it's designed for CQL and the CQL Binary Protocol. It's based on the original work of Matt Stump on libcql. As Matt has recently joined DataStax, the effort on this C++ interface for Cassandra will be continued within this new project and libcql will no longer be maintained.

This new driver is still under development but all the major features that you can find in our other drivers are already there:

  • Native API for CQL
  • Fully asynchronous architecture, making it easy to send several requests in parallel without any thread pool tuning
  • Support for Prepared Statements
  • Automatic fail over and reconnection
  • Support for CQL Collections
  • SSL support and Authentication
  • Load Balancing and Retry Policies
  • Similar API as other DataStax Drivers to make it easier for polyglot applications and developers

We have some work planned on adding support for compression and query tracing before we finalize a first version of this driver. Meanwhile, as for our other drivers, we'll heavily test it to make sure it's ready for the most demanding production deployments.

A first beta will be released soon. Meanwhile the following resources are available to help you to start:

Don't hesitate to give a try to this driver and share your comments or feedbacks with us!

DataStax has many ways for you to advance in your career and knowledge.

You can take free classes, get certified, or read one of our many white papers.

register for classes

get certified

DBA's Guide to NoSQL


  1. Curt says:

    In the absence of a “C” library/driver for Cassandra, is it possible to use this driver from pure C applications?

  2. David Guldbrandsen says:

    Hi Michael,

    I have made my own CQL lib some time ago and i’m trying to support lightweight transactions, but keep getting an error message that “Cannot achieve consistency level QUORUM”. I looked at your code to see if there was something i was missing. It appears that you have a bug in connection.cpp the “prepare” function. It adds the size of int16 twice if the CASS_QUERY_FLAG_SERIAL_CONSISTENCY flag is set. Is that by intention or have you not tried conditional updates?

    Do you know what might be the cause of my problem?


    1. David Guldbrandsen says:

      Now I tried to build the c++ driver and call my conditional query in basic.c after the table is created. I get the same result.

      The query:

      “UPDATE examples.basic SET flt=1.0 WHERE key=’test1’IF flt=2.0;”

      The result:

      “Error: Cannot achieve consistency level QUORUM”

      What am I doing wrong?

      1. Shamin weerarathna says:

        This is because you have set the consistency level to QUORUM and your query try to get the response from more than half of the nodes in your cluster. You can eliminate the issue by setting up the consistency level to ONE or making sure all of your Cassandra nodes up and running properly.

  3. Narasimha says:

    I am new to Cassandra and No SQL. I am experimenting with cassandra in a single centOS system. I used libcql client and able to insert 1 row. i checked in cqlsh and that row got inserted. later, i restarted the system. when i see records in sqlsh, the inserted row is missing.

    I used all default configurations while installing cassandra. do i need to setup any commit time to really add records to persistent storage ? any help in this regard is much appreciated.

    I used sample libcql demo application and modified it to insert a record into my keyspace. if you want any further details, please let me know. more happy to share.


    1. Narasimha says:

      Same result with CPP driver also. Missing records when cassandra is stopped and started again. Hope i am missing something which is very important to make it persistent.

      1. Narasimha says:

        able to get it when using nodetool flush… but, is there a way to flush from API ?

  4. Narasimha says:

    Getting below exception under 10000 TPS…

    Exception: no host is available according to load balancing policy.

  5. Satyam Kumar Das says:

    i am getting errors while building the driver, it gives me a message as “could not find boost”, “could not find libssh2”.

    Please let me know how i can fix this issue ?

    1. Narayana Vasa says:

      I am new to Cassandra. I installed c++ driver from Datastax. Can some one please provide me the steps like in which path I have to create the ‘.c’ file and how I can compile it. I can see some example programs in example folder. Can anyone plz tell me how to compile the example programs.

  6. manoj says:

    I use Cassandra c/c++ 2.2 driver with cassandra-2.1.10
    while im inseting via loop, it gives no host available error same code work standalone, but if I run through loop it gave same error. Please advice

  7. Suresh Phapale says:

    I am trying to install Cassandra C++ driver on windows 7,but I am getting an error message on console —>
    system can not find the path specified BUILDRIVER


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

Subscribe for newsletter: