Connect to a Astra DB Classic database

When you develop applications that interact with your Astra DB Classic databases, you must connect to your databases programmatically.

Astra DB Classic offers several methods to connect to your databases including APIs, CLI tools, and drivers.

Depending on your use case, you might use one or more of these options.

Use case Recommended methods

Application development

CQL and Drivers

Perform administrative tasks programmatically

Migration and bulk loading

Third-party integrations

Varies by provider and use case; see Integrations overview

Programmatic authentication is handled through either application tokens or Secure Connect Bundles.

Drivers

You can use drivers to interact with your Astra DB databases, including sending Cassandra Query Language (CQL) statements.

The following drivers are compatible with Astra DB:

Language Driver Driver version Documentation

C++

cpp-driver

Latest cpp-driver release on GitHub

Connect with the C++ driver

C#

csharp-driver

Latest csharp-driver release on GitHub

Connect with the C# driver

Go

gocql-astra (with cassandra-gocql-driver)

Latest gocql release on GitHub

Connect with the Go driver

Java

cassandra-java-driver

Latest cassandra-java-driver release on GitHub

Connect with the Java driver

Node.js

nodejs-driver

Latest nodejs-driver release on GitHub

Connect with the Node.js driver

Python

python-driver

Latest python-driver release on GitHub

Connect with the Python driver

Scala

spark-cassandra-connector

Latest spark-cassandra-connector release on GitHub

Connect to Astra DB Classic with the Apache Spark Cassandra connector

Legacy drivers

The following legacy drivers were developed for Apache Cassandra®. They are not actively maintained. DataStax recommends using supported drivers. Only use the following legacy drivers to migrate an existing Cassandra application developed with a legacy driver to Astra DB:

If you want to use a CQL driver that isn’t compatible with Astra DB, consider using cql-proxy. This utility provides connectivity for incompatible drivers by securely forwarding your application’s CQL traffic to an appropriate database service.

cql-proxy isn’t required for supported driver versions, which are already compatible with Astra DB Classic.

CQL shell

Because Astra DB Classic is powered by Apache Cassandra®, you can use Cassandra Query Language (CQL) to programmatically interact with your databases through the CQL shell (cqlsh) or a driver. For more information, see CQL for Astra DB.

DataStax Bulk Loader

The DataStax Bulk Loader (DSBulk) supports large data uploads and migrations. For more information, see the DataStax Bulk Loader reference.

Astra CLI

The Astra DB Command-Line Interface (Astra CLI) provides commands you can use to create and manage Astra DB and Astra Streaming resources.

For example:

For more information and commands, see the Astra CLI documentation

You can use Astra CLI in addition to other connection methods.

DevOps API

Use the DevOps API for administration and high-level database management tasks, such as database creation, user management, and security configurations.

For more information, see Get started with the Astra DevOps API.

Legacy Stargate APIs (deprecated)

The legacy Stargate APIs are deprecated for Astra DB Classic as of September 2024, and end-of-life (EOL) is scheduled for the end of 2025. As EOL approaches, DataStax will provide migration information to support your transition to other options.

If you have questions or concerns, contact your account representative or DataStax Support.

Legacy Stargate APIs include the following:

  • Document API: If you use this API, DataStax recommends that you use the vector-enabled Data API.

  • REST API: Exposes CRUD access to data stored in Cassandra tables.

  • GraphQL API: Modifies and queries table data using GraphQL types, mutations, and queries with any Cassandra deployment.

  • gRPC API: A data gateway deployed between client applications and a database. The Stargate gRPC API is implemented to create language-specific queries using CQL with any Cassandra deployment.

Table-based authentication and authorization for legacy APIs (deprecated)

Table-based authentication and authorization uses the Stargate Auth API to generate an auth token based on a Cassandra username and password. The auth-table-based-service uses the generated auth token to allow Stargate API queries access to your database.

By default, the token persists for 30 minutes with a sliding window. Each use of the token to authenticate resets the 30 minute window. A token created and used after 29 minutes will authenticate a request, but if 31 minutes pass before use, the token will no longer exist.

The length of time to persist the token is configurable using the system property stargate.auth_tokenttl. For example, the following configuration sets the token lifetime to 100 seconds:

JAVA_OPTS='-Dstargate.auth_tokenttl=100' ./starctl \
--developer-mode --cluster-name test --cluster-version 3.11 --enable-auth

You can use the REST API to generate an auth token:

curl -L -X POST "https://ASTRA_DB_ID-ASTRA_DB_REGION.apps.astra.datastax.com/api/rest/v1/auth" \
-H "Content-Type: application/json" \
--data-raw '{
  "username": "CLIENT_ID",
  "password": "CLIENT_SECRET"
}'

A successful response includes the authentication token:

{ "authToken": "AUTH_TOKEN" }

You must provide this token in each subsequent request in the X-Cassandra-Token header. You can provide the token directly in the header or export it as an environment variable.

  • REST or Document API (v2): Store the auth token in an environment variable to make it easy to use with HTTP:

    export AUTH_TOKEN=AUTH_TOKEN
  • GraphQL: Add the auth token to the HTTP Headers box in the GraphQL playground:

    { "X-Cassandra-Token": "AUTH_TOKEN" }

Astra Portal

The Astra Portal provides a web-based interface to manage your Astra DB organizations and databases. It is best for administrative tasks and high-level database management, including inspecting database health metrics.

For application development, fine-grained data manipulation, and nuanced searches, you must use a programmatic approach.

For information about accessing the Astra Portal, see Manage your Astra account and Firewall rules for the Astra Portal.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2025 DataStax | Privacy policy | Terms of use | Manage Privacy Choices

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com