DataStax Enterprise C/C++ Driver: 1.0 released!

By Michael Penick -  October 20, 2016 | 0 Comments

Earlier this year, we announced the release of Datastax Enterprise (DSE) 5.0 and, shortly after that, the general availability of new dedicated drivers.

In this post we are going to focus on the DataStax Enterprise C/C++ Driver 1.0.


The DataStax Enterprise C/C++ Driver 1.0 is built on top of the “core” driver and supports additional features provided by DSE 5.0, such as Unified Authentication, Geospatial types, and Graph.

The DataStax Enterprise driver uses the same “core” object drivers where possible to make integration straightforward and easy. The main difference is your application must include a the new dse.h header file.

#include <dse.h> /* Use this instead of `cassandra.h` */

int main() {

  /* It's highly recommended that your application use this function
   * to create cluster instead of `cass_cluster_new()`. This enables
   * DSE specific settings and policies.
  CassCluster* cluster = cass_cluster_new_dse();

  /* ... */


Unified authentication

DSE 5.0 adds DSE Unified Authentication which supports using different authentication schemes simultaneously on the same cluster. DSE Unified Authentication and the DataStax Enterprise C/C++ Driver supports the following authentication providers: internal authentication, LDAP, and Kerberos (GSSAPI).

Internal and LDAP Authentication

These providers use plaintext authentication and should use the cass_cluster_set_dse_plaintext_authenticator() function to the set username and password credentials.

CassCluster* cluster = cass_cluster_new_dse();

cass_cluster_set_dse_plaintext_authenticator(cluster, "username", "password");

/* ... */


Kerberos Authentication

The Kerberos provider uses GSSAPI and should use the cass_cluster_set_dse_gssapi_authenticator() function to set the Kerberos ticket information.

CassCluster* cluster = cass_cluster_new_dse();

/* By default the hostname is used to lookup and verify a Kerberos ticket, otherwise,
 * the IP address is used. If using the hostname then reverse DNS must be enabled.
cass_cluster_set_use_hostname_resolution(cluster, cass_true);

/* Specify the service and principle for Kerberos. To use the default principle
 * use an empty string.
cass_cluster_set_dse_gssapi_authenticator(cluster, "dse", "dse@DATASTAX.COM");

/* ... */


For more information check out the documentation and the GSSAPI example.

Geospatial types

DSE 5.0 comes with a set of additional types to represent geospatial data: PointType, LineStringType, and PolygonType. Here is an example of a table containing a column of type PointType:

CREATE TABLE points_of_interest(name text PRIMARY KEY, coords 'PointType');

The CQL literal representing a geospatial type is simply its Well-known Text (WKT) form. Inserting a row into the table above using plain CQL is as easy as:

INSERT INTO_ points_of_interest (name, coords) VALUES ('Eiffel Tower', 'POINT(48.8582 2.2945)');

Of course, you are not limited to string literals to manipulate geospatial types; the DataStax Enterprise C/C++ Driver 1.0 also includes its own representations of these types, which can be sent as query parameters, or retrieved back from query results:

CassStatement* statement =
  cass_statement_new("INSERT INTO_ points_of_interest (name, coords) VALUES (?, ?)", 2);

cass_statement_bind_string(statement, 0, "Eiffel Tower");

/* Bind a point using with the point's components */
cass_statement_bind_dse_point(statement, 1, 48.8582, 2.2945);

/* Execute statement */

For more infomration check out the documentation and the geotypes example.


DSE 5.0 also brought with it the inclusion of a powerful graph database: DSE Graph. The DataStax Enterprise C/C++ Driver now supports using Gremlin, a graph traversal language, for interacting with DSE Graph.

CassSession now accepts graph queries using the cass_session_execute_dse_graph() function. This execute function accepts the new statement type DseGraphStatement.

Here’s a simple example of a graph query:

/* Create a graph options so that we can set a specific graph name: "test" */
DseGraphOptions* options = dse_graph_options_new();

/* Set the graph name */
dse_graph_options_set_graph_name(options, "test");

/* Create a graph query */
DseGraphStatement* statement =
  dse_graph_statement_new("g.V().has('name','marko').out('knows').values('name')", options);

/* Execute the graph query */
CassFuture* future =
  cass_session_execute_dse_graph(session, statement);

/* Check and handle the result */
if (cass_future_error_code(future) == CASS_OK) {
  DseGraphResultSet* resultset = cass_future_get_dse_graph_resultset(future);

  /* Handle result set */
} else {
  /* Handle error */

/* Cleanup */

Please refer to both the DSE 5.0 Graph documentation and the driver documentation on graph for further information about graph queries.

Getting the driver

The DataStax Enterprise C/C++ Driver binaries are available on our downloads site or the driver can be built from scratch using this documentation.

Be aware that the DataStax Enterprise C/C++ Driver is published under specific license terms that allow its usage solely in conjunction with DataStax Enterprise software.

Resources for the the DataStax Enterprise C/C++ Driver can be found at the following locations:


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

Subscribe for newsletter:

© 2017 DataStax, All rights reserved. Tel. +1 (408) 933-3120 Offices

DataStax is a registered trademark of DataStax, Inc. and its subsidiaries in the United States and/or other countries.
Apache Cassandra, Apache, Tomcat, Lucene, Solr, Hadoop, Spark, TinkerPop, and Cassandra are trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.