Migrate C++ driver
Complete the following procedure to migrate your existing DataStax C++ driver to a version that is capable of connecting to Astra databases created using DataStax Astra DB.
Prerequisites
-
Create a database using Astra DB.
-
Download the secure connect bundle to obtain connection credentials for your Astra DB database.
-
Get your Client ID and Client Secret by creating your application token for your username and password.
Alternatively, have a teammate provide access to their Astra database.
-
Download the DataStax C++ driver and dependency packages for your platform using the links in the following table:
DataStax C++ driver download links
Platform | Download links |
---|---|
CentOS 6 |
|
CentOS 7 |
|
CentOS 8 |
|
Ubuntu 14.04 |
|
Ubuntu 16.04 |
|
Ubuntu 18.04 |
|
Windows |
Other platforms should build the driver from the source code packages.
-
Using the packages you downloaded, follow the installation instructions for your platform to install the DataStax C++ driver.
Procedure
-
In your existing DataStax C++ driver code, modify the connection code to use the Astra DB API.
Both the DataStax C driver for Apache Cassandra and the {company} Enterprise (DSE) C driver use the same code to connect and query your Astra database. When using the DSE C++ driver, use the header
#include <dse.h>
.The
secure_connect_bundle
must include the absolute path to your Astra database credentials (secure-connect-**database_name**.zip
).cass_cluster_set_credentials(cluster, "clientId", "clientSecret"); CassFuture* connect_future = cass_session_connect(session, cluster); if (cass_future_error_code(connect_future) == CASS_OK) { * Use the session to run queries _ } else { _ Handle error * }
-
Build and link your application against the DataStax C++ driver.
-
Linux or macOS
For static linking, use
cassandra_static.a
ordse_static.a
. -
Windows Include these libraries in your Microsoft Visual Studio project by adding them to the project’s properties under ]
Configuration Properties/Linker/Input/Additional Dependencies
.For static linking, use
cassandra_static.lib
ordse_static.lib
pass:c[.
-
DataStax C++ driver for Apache Cassandra
Link your application against cassandra.lib
.
Your application will also require `cassandra.dll
to be in your runtime path.
DSE C++ driver
Link your application against dse.lib
.
Your application will also require dse.dll
to be in your runtime path.