C/C++ DataStax Enterprise Driver

Build Status: Linux Build Status: Windows

A driver built specifically for the DataStax Enterprise (DSE). It builds on the DataStax C/C++ driver for Apache Cassandra and includes specific features for DSE.

This software can be used solely with DataStax Enterprise. See the License section below.

Note: DataStax products do not support big-endian systems.

Getting the Driver

Binary versions of the driver, available for multiple operating systems and multiple architectures, can be obtained from our download server.

Features

DSE v5.0+

DSE v5.1+

Documentation

Getting Help

Feedback Requested

Help us focus our efforts! Provide your input on the DSE C/C++ Driver Platform and Runtime Survey (we kept it short).

Examples

Examples for using the driver can be found in our examples repository.

A Simple Example

Connecting the driver is is the same as the core C/C++ driver except that dse.h should be included instead of cassandra.h which is automatically included by dse.h.

/* Include the DSE driver */
#include <dse.h>

int main() {
  /* Setup and connect to cluster */
  CassFuture* connect_future = NULL;
  CassCluster* cluster = cass_cluster_new();
  CassSession* session = cass_session_new();

  /* Add contact points */
  cass_cluster_set_contact_points(cluster, "127.0.0.1");

  /* Provide the cluster object as configuration to connect the session */
  connect_future = cass_session_connect(session, cluster);

  if (cass_future_error_code(connect_future) == CASS_OK) {

    /* Run queries here */

    /* Close the session */
    close_future = cass_session_close(session);
    cass_future_wait(close_future);
    cass_future_free(close_future);
  } else {
    /* Handle error */
    const char* message;
    size_t message_length;
    cass_future_error_message(connect_future, &message, &message_length);
    fprintf(stderr, "Unable to connect: '%.*s'\n", (int)message_length,
                                                        message);
  }

  /* Cleanup driver objects */
  cass_future_free(connect_future);
  cass_cluster_free(cluster);
  cass_session_free(session);

  return 0;
}

License

Copyright © DataStax, Inc.

http://www.datastax.com/terms/datastax-dse-driver-license-terms