Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

article

smadhavan avatar image
smadhavan posted smadhavan edited

HOW TO - Connect to Astra DB from DataStax Studio

Overview

This article provides the steps for connecting to Astra DB from DataStax Studio.

At a high level, it involves:

  1. Generating an application token for your Astra DB.
  2. Downloading the secure bundle for your Astra DB.
  3. Downloading and Installing DataStax Studio 6.8.
  4. Configuring your DataStax Studio installation.

Prerequisites

This article assumes you have a running installation of DataStax Astra DB & DataStax Studio. This procedure was written and tested on macOS/Linux package [Macbook running macOS Big Sur] with DataStax Studio v6.8. Older versions of DataStax Studio does not support connecting to the Astra DB.

You will also need to generate an application token and download the secure bundle for your Astra DB.

You will need to choose which keyspace to use to store your data. If it doesn't exist, you will need to create the keyspace on the Astra DB UI.

NOTE: For simplicity, the secure connect bundle has been placed in /path/to/scb, the DataStax Studio is installed at /path/to/studio and I have named my Astra DB as speedlayer.

Download & Install of DataStax Studio v6.8 information

  • Downloaded the latest version of DataStax Studio 6.8 from the downloads page. (Example here: Version 6.8; Package: macOS/Linux)
  • Unzip the downloaded package and fire up the studio.sh from within the bin directory. You will notice Studio starting up like as follows,
bin/server.sh
Starting Studio. This may take a few minutes. You will be notified here when Studio is ready.


Starting ========= ==========

after few moments, you will be seeing similar to the below,

> /path/to/studio/bin/server.sh
Starting Studio. This may take a few minutes. You will be notified here when Studio is ready
                               
NOTE: Studio will only be accessible on this machine.
To enable remote connections, modify the httpBindAddress setting in configuration.yaml to 0.0.0.0 (all addresses) or a publicly accessible address. However, note that doing so may introduce a security risk.
Visit https://docs.datastax.com/en/allStudioConfig/ for configuration documentation.

Studio 6.8.N-<alpha-numeric> is now running at: http://localhost:9091

Upon navigating to the above URL where DataStax Studio is running, you will be presented with a similar screen,


1631139394250.pngDataStax Studio Home screen



Procedure

Creating and downloading the application token for the Astra DB

  • From the AstraDB Token management page -> Create a token with an appropriate (for e.g. Database Admin) role. One could choose from a variety of roles depending on their use case.
  • Download the CSV file. This will be the only time to download the CSV. Once you navigate away from this screen, you will not be able to download the CSV for security reasons

Downloading the Secure Connect Bundle (SCB) for the Astra DB

  • Navigate to the "Connect" tab from within your Astra DB
  • Choose from one of the language drivers menus
  • Click "Download Bundle" and download the secure connect bundle for the interested region

download-secure-connect-bundle-astradb.pngDownloading Secure Connect Bundle for the Astra DB



Creating a connection on the DataStax Studio to Astra DB

  • From the DataStax Studio Main Menu (sandwich icon on the top left), choose "Connections"
  • Hit the + icon to Add a new connection
  • Choose "ASTRA CONNECTION" tab
  • Provide a "Name" of your choice
  • Provide the fully qualified path of the downloaded Secure Connect Bundle
  • From the downloaded application token CSV file, copy and paste the "Client ID"
  • From the downloaded application token CSV file, copy and paste the "Client Secret"
  • Hit "Test" button
  • Upon receiving "Connected successfully" message next to the "Test" button, hit "Save" button to save the connection. You could ignore the "Database authorization problem." warning message on this step.

TIP: One could use the string literal "token" as "Client ID" and provide the "Token" value (which start with AstraCS:) from the downloaded CSV file for the "Client Secret" field on the connection panel.


studio-new-connection-astradb.pngCreating a new connection to Astra DB



studio-new-connection-added-successfully.pngNew DataStax Studio connection to Astra DB


Final Test

From the DataStax Studio, create a new notebook to leverage the Astra DB connection that we just created in earlier steps and run a sample query to validate the connection.

studio-notebook-run-query-astradb.pngValidating the connection to Astra DB by running a query on the newly created DataStax Studio Notebook


studioastra db
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Article

Contributors

smadhavan contributed to this article