- Notifications
You must be signed in to change notification settings - Fork286
DataStax C/C++ Driver for Apache Cassandra
License
datastax/cpp-driver
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A modern, feature-rich and highly tunable C/C++ client library forApache Cassandra® 2.1+ using exclusively Cassandra's binary protocol andCassandra Query Language v3. This driver can also be used with other DataStaxproducts:
The source code is made available viaGitHub. Additionally binary versions ofthe driver (for multiple operating systems and multiple architectures) can beobtained from ourArtifactory server. Binaries are available for the followingoperating 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 usedto build the driver. A version of libuv > 1.x is provided for CentOS 7 and RockyLinux; this can be found under thedependencies
directory for each platform.Packages for all three dependencies are provided for Windows distributions.
Starting with DataStax C/C++ driver for Apache Cassandra® v2.15.0, DataStaxEnterprise (DSE) support is now available; using the DSE driver exclusively is nolonger required for DSE customers.
Linking changes will be required when migrating to this driver. Replace-ldse
with-lcassandra
.
No changes will be required when upgrading to this driver. There will be newdriver dependencies when using any of the binary versions obtained from ourArtifactory server asKerberos is utilized in theDSE features of thisdriver. See the [installation] section for more information on obtaining thedependencies for a specific platform.
- Asynchronous API
- Simple,Prepared, andBatch statements
- Asynchronous I/O,parallel execution, and request pipelining
- Connection pooling
- Automatic node discovery
- Automatic reconnection
- Configurableload balancing
- Works with any cluster size
- Authentication
- SSL
- Latency-aware routing
- Performance metrics
- Tuples andUDTs
- Nested collections
- Retry policies
- Client-side timestamps
- Data types
- Idle connection heartbeats
- Support for materialized view and secondary index metadata
- Support for clustering key order,
frozen<>
and Cassandra version metadata - Blacklist,whitelist DC, andblacklist DC load balancing policies
- Custom authenticators
- Reverse DNS with SSL peer identity verification support
- Randomized contact points
- Speculative execution
- DSE Features
- DSE authentication
- Plaintext/DSE
- LDAP
- GSSAPI (Kerberos)
- DSE geospatial types
- DSEproxy authentication andproxy execution
- DSE DateRange
- DSE authentication
- Support forDataStax Astra Cloud Data Platform
This driver works exclusively with the Cassandra Query Language v3 (CQL3) andCassandra's native protocol. The current version works with the followingserver 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 foundhere.
Disclaimer: DataStax products do not support big-endian systems.
- JIRA:jira
- Mailing List:mailing list
The driver includes several examples in theexamples directory.
#include<cassandra.h>/* Use "#include <dse.h>" when connecting to DataStax Enterpise */#include<stdio.h>intmain(intargc,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 */constchar*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 */constCassResult*result=cass_future_get_result(result_future);constCassRow*row=cass_result_first_row(result);if (row) {constCassValue*value=cass_row_get_column_by_name(row,"release_version");constchar*release_version;size_trelease_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 */constchar*message;size_tmessage_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 */constchar*message;size_tmessage_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);return0;}
© DataStax, Inc.
Licensed under the Apache License, Version 2.0 (the “License”); you may not usethis file except in compliance with the License. You may obtain a copy of theLicense at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributedunder the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES ORCONDITIONS OF ANY KIND, either express or implied. See the License for thespecific language governing permissions and limitations under the License.
About
DataStax C/C++ Driver for Apache Cassandra
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.