How to connect to Cassandra Cloud AstraDb with JDBC ?


This article shows you how you can connect to an AstraDb database with Jdbc. 1)


Download the Cassandra Astra Driver

Download the JDBC driver at datastax 2)

Optional for Idea - Create a new driver

Create a new driver with the following properties:

  • Driver File: CassandraJDBC42.jar
  • Driver Class: com.simba.cassandra.jdbc42.Driver


From the Astra DB console:

Connect String

Create a new connection with the following JDBC URL

jdbc:cassandra://keyspace;DefaultKeyspace=keyspace;AuthMech=2;UID=token;PWD=<ApplicationToken>;SecureConnectionBundlePath=<PATH TO YOUR SECURE CONNECT BUNDLE>;TunableConsistency=6


  • keyspace is the keyspace you want to connect to (Optional)
  • DefaultKeyspace is the default keyspace (Optional)
  • AuthMech: Specifies whether the driver connects to a Cassandra or Astra DB database and whether the driver authenticates the connection.
  • ApplicationToken: The generated from Astra DB console.
  • SecureConnectionBundlePath: Path to where your downloaded Secure Connect Bundle is located.
  • TunableConsistency: Specifies Cassandra replica or the number of Cassandra replicas that must process a query for the query to be considered successful.

Example on Idea:

For legacy driver, client id and client secret correspond to username and password. They are created when you generate your application token.

Powered by ComboStrap