• Stars
    star
    390
  • Rank 106,588 (Top 3 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DataStax C/C++ Driver for Apache Cassandra

DataStax C/C++ Driver for Apache Cassandra® and DataStax Products

A modern, feature-rich and highly tunable C/C++ client library for Apache Cassandra® 2.1+ using exclusively Cassandra's binary protocol and Cassandra Query Language v3. This driver can also be used with other DataStax products:

Getting the Driver

The source code is made available via GitHub. Additionally binary versions of the driver (for multiple operating systems and multiple architectures) can be obtained from our Artifactory server. Binaries are available for the following operating systems:

  • CentOS 7
  • Rocky Linux 8.8
  • Rocky Linux 9.2
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Windows

The driver depends on the following libraries:

  • libuv (1.x)
  • OpenSSL
  • zlib

The version of OpenSSL and zlib provided with each Linux distribution above can be used to build the driver. A version of libuv > 1.x is provided for CentOS 7 and Rocky Linux; this can be found under the dependencies directory for each platform. Packages for all three dependencies are provided for Windows distributions.

Upgrading

Starting with DataStax C/C++ driver for Apache Cassandra® v2.15.0, DataStax Enterprise (DSE) support is now available; using the DSE driver exclusively is no longer required for DSE customers.

For DSE driver users

Linking changes will be required when migrating to this driver. Replace -ldse with -lcassandra.

For Cassandra driver users

No changes will be required when upgrading to this driver. There will be new driver dependencies when using any of the binary versions obtained from our Artifactory server as Kerberos is utilized in the DSE features of this driver. See the [installation] section for more information on obtaining the dependencies for a specific platform.

Features

Compatibility

This driver works exclusively with the Cassandra Query Language v3 (CQL3) and Cassandra's native protocol. The current version works with the following server versions:

  • Apache Cassandra® versions 3.0.x, 3.11.x and 4.0.x
  • DSE versions 6.8.x and 5.1.x

Both 32-bit (x86) and 64-bit (x64) architectures are supported

We build and test the driver on the following platforms:

  • CentOS 7 w/ gcc 4.8.5
  • Rocky Linux 8.8 w/ gcc 8.5.0
  • Rocky Linux 9.2 w/ gcc 11.3.1
  • Ubuntu 20.04 w/ gcc 9.4.0
  • Ubuntu 22.04 w/ gcc 11.3.0
  • Microsoft Visual Studio 2013, 2015, 2017 and 2019

A complete compatibility matrix for both Apache Cassandra® and DataStax Enterprise can be found here.

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

Documentation

Getting Help

Examples

The driver includes several examples in the examples directory.

A Simple Example

#include <cassandra.h>
/* Use "#include <dse.h>" when connecting to DataStax Enterpise */
#include <stdio.h>

int main(int argc, char* argv[]) {
  /* Setup and connect to cluster */
  CassFuture* connect_future = NULL;
  CassCluster* cluster = cass_cluster_new();
  CassSession* session = cass_session_new();
  char* hosts = "127.0.0.1";
  if (argc > 1) {
    hosts = argv[1];
  }

  /* Add contact points */
  cass_cluster_set_contact_points(cluster, hosts);

  /* 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) {
    CassFuture* close_future = NULL;

    /* Build statement and execute query */
    const char* query = "SELECT release_version FROM system.local";
    CassStatement* statement = cass_statement_new(query, 0);

    CassFuture* result_future = cass_session_execute(session, statement);

    if (cass_future_error_code(result_future) == CASS_OK) {
      /* Retrieve result set and get the first row */
      const CassResult* result = cass_future_get_result(result_future);
      const CassRow* row = cass_result_first_row(result);

      if (row) {
        const CassValue* value = cass_row_get_column_by_name(row, "release_version");

        const char* release_version;
        size_t release_version_length;
        cass_value_get_string(value, &release_version, &release_version_length);
        printf("release_version: '%.*s'\n", (int)release_version_length, release_version);
      }

      cass_result_free(result);
    } else {
      /* Handle error */
      const char* message;
      size_t message_length;
      cass_future_error_message(result_future, &message, &message_length);
      fprintf(stderr, "Unable to run query: '%.*s'\n", (int)message_length, message);
    }

    cass_statement_free(statement);
    cass_future_free(result_future);

    /* 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);
  }

  cass_future_free(connect_future);
  cass_cluster_free(cluster);
  cass_session_free(session);

  return 0;
}

License

© DataStax, Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

spark-cassandra-connector

DataStax Connector for Apache Spark to Apache Cassandra
Scala
1,930
star
2

python-driver

DataStax Python Driver for Apache Cassandra
Python
1,371
star
3

nodejs-driver

DataStax Node.js Driver for Apache Cassandra
JavaScript
1,227
star
4

csharp-driver

DataStax C# Driver for Apache Cassandra
C#
623
star
5

php-driver

[MAINTENANCE ONLY] DataStax PHP Driver for Apache Cassandra
C
433
star
6

cass-operator

The DataStax Kubernetes Operator for Apache Cassandra
Go
256
star
7

ruby-driver

[MAINTENANCE ONLY] DataStax Ruby Driver for Apache Cassandra
Ruby
227
star
8

graph-book

The Code Examples and Notebooks for The Practitioners Guide to Graph Data
Shell
187
star
9

cql-proxy

A client-side CQL proxy/sidecar.
Go
170
star
10

metric-collector-for-apache-cassandra

Drop-in metrics collection and dashboards for Apache Cassandra
Java
107
star
11

ragstack-ai

RAGStack is an out of the box solution simplifying Retrieval Augmented Generation (RAG) in AI apps.
Python
87
star
12

dsbulk

DataStax Bulk Loader (DSBulk) is an open-source, Apache-licensed, unified tool for loading into and unloading from Apache Cassandra(R), DataStax Astra and DataStax Enterprise (DSE)
Java
76
star
13

docker-images

Docker images published by DataStax.
Shell
73
star
14

dynamo-cassandra-proxy

Preview version of an open source tool that enables developers to run their AWS DynamoDB™ workloads on Apache Cassandra™. With the proxy, developers can run DynamoDB workloads outside of AWS (including on premises, other clouds, and in hybrid configurations).
Java
73
star
15

cstar_perf

Apache Cassandra performance testing platform
Python
72
star
16

zdm-proxy

An open-source component designed to seamlessly handle the real-time client application activity while a migration is in progress.
Go
71
star
17

ai-chatbot-starter

A starter app to build AI powered chat bots with Astra DB and LlamaIndex
Python
63
star
18

astra-assistants-api

A backend implementation of the OpenAI beta Assistants API
Python
62
star
19

zdm-proxy-automation

An Ansible-based automation suite to deploy and manage the Zero Downtime Migration Proxy
Go
60
star
20

graph-examples

Java
52
star
21

fallout

Distributed System Testing as a Service
Java
51
star
22

pulsar-jms

DataStax Starlight for JMS, a JMS API for Apache Pulsar ®
Java
47
star
23

reactive-pulsar

Reactive Streams adapter for Apache Pulsar Java Client
Java
47
star
24

pulsar-helm-chart

Apache Pulsar Helm chart
Mustache
46
star
25

kafka-examples

Examples of using the DataStax Apache Kafka Connector.
Java
45
star
26

ragbot-starter

An Astra DB and OpenAI chatbot
TypeScript
40
star
27

cassandra-quarkus

An Apache Cassandra(R) extension for Quarkus
Java
39
star
28

wikichat

Python
39
star
29

SwiftieGPT

TypeScript
35
star
30

kaap

KAAP, Kubernetes Autoscaling for Apache Pulsar
Java
34
star
31

pulsar-admin-console

Pulsar Admin Console is a web based UI that administrates topics, namespaces, sources, sinks and various aspects of Apache Pulsar features.
Vue
34
star
32

sstable-to-arrow

Java
33
star
33

simulacron

Simulacron - An Apache Cassandra® Native Protocol Server Simulator
Java
32
star
34

cdc-apache-cassandra

Datastax CDC for Apache Cassandra
Java
32
star
35

code-samples

Code samples from DataStax
Scala
31
star
36

astra-cli

Command Line Interface for DataStax Astra
Java
30
star
37

diagnostic-collection

Set of scripts for collection of diagnostic information from DSE/Cassandra clusters
Python
28
star
38

starlight-for-rabbitmq

Starlight for RabbitMQ, a proxy layer between RabbitMQ/AMQP0.9.1 clients and Apache Pulsar
Java
27
star
39

dse-metric-reporter-dashboards

Prometheus & Grafana dashboards for DSE metric collector
Python
27
star
40

spark-cassandra-stress

A tool for testing the DataStax Spark Connector against Apache Cassandra or DSE
Scala
26
star
41

cla-enforcer

A Contributor License Agreement enforcement bot
Ruby
25
star
42

pulsar-heartbeat

Pulsar Heartbeat monitors Pulsar cluster availability, tracks latency of Pulsar message pubsub, and reports failures of the Pulsar cluster. It produces synthetic workloads to measure end-to-end message pubsub latency.
Go
23
star
43

cassandra-data-migrator

Cassandra Data Migrator - Migrate & Validate data between origin and target Apache Cassandra®-compatible clusters.
Java
22
star
44

cassandra-log4j-appender

Cassandra appenders for Log4j
Java
20
star
45

cassandra-data-apis

Data APIs for Apache Cassandra
Go
19
star
46

labs

DataStax Labs preview program
Java
19
star
47

terraform-provider-astra

A project that allows DataStax Astra users to manage their full database lifecycle for Astra Serverless databases (built on Apache Cassandra(TM)) using Terraform
Go
18
star
48

dc-failover-demo

Fault Tolerant Applications with Apache Cassandra™ Demo
HCL
17
star
49

astra-sdk-java

Set of client side libraries to help with Astra Platform usage
Java
17
star
50

kafka-sink

Apache Kafka® sink for transferring events/messages from Kafka topics to Apache Cassandra®, DataStax Astra and DataStax Enterprise (DSE).
Java
17
star
51

starlight-for-kafka

DataStax - Starlight for Kafka
Java
15
star
52

astrajs

A monorepo containing tools for interacting with DataStax Astra and Stargate
JavaScript
15
star
53

native-protocol

An implementation of the Apache Cassandra® native protocol
Java
14
star
54

astrapy

AstraPy is a Pythonic interface for DataStax Astra DB and the Data API
Python
14
star
55

block-explorer

TypeScript
13
star
56

go-cassandra-native-protocol

Cassandra Native Protocol bindings for the Go language
Go
12
star
57

cassandra-reactive-demo

A demo application that interacts with Apache Cassandra(R) using the Java driver 4.4+ and reactive programming
Java
11
star
58

pulsar-sink

An Apache Pulsar® sink for transferring events/messages from Pulsar topics to Apache Cassandra®, DataStax Astra or DataStax Enterprise (DSE) tables.
Java
11
star
59

adelphi

Automation tool for testing C* OSS that assembles cassandra-diff, nosqlbench, fqltool
Python
9
star
60

pulsar-transformations

Java
9
star
61

gatling-dse-plugin

Scala
8
star
62

snowflake-connector

Datastax Snowflake Sink Connector for Apache Pulsar
Java
8
star
63

gocql-astra

Support for gocql on Astra
Go
8
star
64

dsbulk-migrator

Java
8
star
65

release-notes

Release Notes for DataStax Products
8
star
66

vault-plugin-secrets-datastax-astra

HashiCorp Vault Plugin for Datstax Astra
Go
8
star
67

pulsar-3rdparty-connector

This project provides simple templates and instructions to build Apache Pulsar connectors on base of the existing Apache Kafka connectors.
Shell
8
star
68

dsbench-labs

DSBench - A Database Testing Power Tool
7
star
69

remote-junit-runner

JUnit runner that executes tests in a remote JVM
Java
7
star
70

cass-config-builder

Configuration builder for Apache Cassandra based on definitions at datastax/cass-config-definitions
Clojure
7
star
71

astra-db-ts

Typescript client for Astra DB Vector
TypeScript
7
star
72

java-driver-scala-extras

Scala extensions and utilities for the DataStax Java Driver
Scala
6
star
73

burnell

A proxy to Pulsar cluster
Go
6
star
74

gatling-dse-stress

Scala
5
star
75

astra-client-go

Go
5
star
76

gatling-dse-simcatalog

Scala
4
star
77

java-quotient-filter

A Java Quotient Filter implementation.
Java
4
star
78

pulsar-ansible

Shell
4
star
79

terraform-helm-oci-release

HCL
3
star
80

ds-support-diagnostic-collection

Scripts for collection of diagnostic information from DSE/Cassandra clusters running on various platforms
Shell
3
star
81

go-cassandra-simple-client

A simple Go client for the Cassandra native protocol
3
star
82

cass-config-definitions

Shell
3
star
83

astra-ide-plugin

Kotlin
3
star
84

charts

DataStax Helm Charts
Shell
3
star
85

astra-db-chatbot-starter

Python
2
star
86

java-driver-examples-osgi

Examples showing the usage of the DataStax Java driver in OSGi applications.
Java
2
star
87

nodejs-driver-graph

DataStax Node.js Driver Extensions for DSE Graph
JavaScript
2
star
88

aws-secrets-manager-integration-astra

Python
2
star
89

starlight-for-grpc

Java
2
star
90

astra-streaming-examples

Java
2
star
91

homebrew-luna-streaming-shell

Shell
2
star
92

astra-block-examples

Various Astra Block Examples
TypeScript
2
star
93

cassandra-drivers-smoke-test

Smoke tests for Apache Cassandra using the DataStax Drivers
Shell
2
star
94

junitpytest

JUnit5 plugin to run pytest via Gradle
Java
2
star
95

migration-docs

JavaScript
2
star
96

venice-helm-chart

Smarty
2
star
97

spark-cassandra-connector-devtools

Extra stuff useful for development of spark-cassandra-connector e.g. performance tests
2
star
98

cpp-dse-driver-examples

Examples for using the DataStax C/C++ Enterprise Driver
C
2
star
99

venice

Java
1
star
100

fallout-tests

Python
1
star