Integrate DataGrip with Astra DB Serverless
DataGrip is an IDE for databases.
This guide explains how to create data sources for Astra DB Serverless databases in DataGrip.
Get a JDBC driver
DataGrip connections require a JDBC driver.
DataGrip can download the JetBrains Apache Cassandra JDBC driver automatically. However, for better compatibility with Astra, DataStax recommends the following JDBC drivers:
-
The open-source
ing-bank/cassandra-jdbc-wrapper
. -
The Astra JDBC connector, which is based on
ing-bank/cassandra-jdbc-wrapper
. -
A DataStax JDBC driver.
You can access the DataStax ODBC and JDBC drivers through the DataStax Support portal or by contacting DataStax Support.
Get Astra DB credentials
-
Create an Astra DB Serverless database or use an existing one.
-
If required to configure your JDBC driver connection, download your database’s Secure Connect Bundle (SCB), and then securely store it where your DataGrip installation can access it.
This isn’t required if your JDBC driver supports token-only authentication with Astra. However, you might need the SCB if you want to enable SSL encryption.
-
Generate an application token with a sufficiently privileged role for the operations you want to perform through DataGrip.
Connect DataGrip to Astra DB Serverless
To connect Astra to DataGrip, you must create a database connection in DataGrip consisting of a JDBC driver and a data source:
-
Download and install DataGrip if you haven’t done so already.
-
Create a DataGrip project or use an existing one.
-
Create one of the following data sources with your JDBC driver:
-
Apache Cassandra data source: If you aren’t using the JetBrains Apache Cassandra JDBC driver, remove the default driver option on the General tab, and then add your JDBC driver JAR file as a custom JAR.
-
Basic data source with a user-created driver: On the Drivers tab, add your JDBC driver JAR file as a custom JAR. After configuring the driver, click Create Data Source to create a data source using the new driver.
The Class is the fully-qualified name of the main class for your JDBC driver. For example, for the OSS Cassandra JDBC driver (
ing-bank/cassandra-jdbc-wrapper
), the main class iscom.ing.data.cassandra.jdbc.CassandraDriver
, and for the Astra JDBC connector, the main class iscom.datastax.astra.jdbc.AstraJdbcDriver
.DataGrip attempts to automatically detect classes in your driver library. If DataGrip doesn’t automatically detect the correct class, you must provide it manually.
-
-
For Connection type, select URL only, and then configure the database connection:
-
Authentication: Select User & Password
-
User: Enter
token
-
Password: Provide your application token
-
URL: Provide the URL to connect your driver to Astra.
-
OSS Cassandra JDBC driver
-
Astra JDBC connector
-
JetBrains JDBC driver
-
DataStax JDBC driver
To connect the OSS Cassandra JDBC driver to Astra, provide the JDBC URL for your driver version:
Version 4.16 and laterjdbc:cassandra:astra://DB_NAME/KEYSPACE?token=APPLICATION_TOKEN&consistency=LOCAL_QUORUM
Version 4.15.z and earlierjdbc:cassandra:dbaas:///KEYSPACE?consistency=LOCAL_QUORUM&user=token&password=APPLICATION_TOKEN&secureconnectbundle=/PATH/TO/SCB.zip
At minimum, you must provide your database’s name, a keyspace, and an application token:
jdbc:astra://DB_NAME/KEYSPACE_NAME?token=APPLICATION_TOKEN
For more information, see the repository for the Astra JDBC connector.
DataStax doesn’t test the JetBrains Apache Cassandra JDBC driver on Astra. For assistance with this driver, contact JetBrains Support.
To get the Host and Port for the JDBC driver URL, extract your database’s Secure Connect Bundle (SCB) archive, open
config.json
, and then find thehost
andport
fields.Contact DataStax Support for information about the DataStax JDBC drivers.
-
-
-
Click Test Connection to verify the connection, and then click Apply.
-
Optional: To connect to other keyspaces in the same database, edit the data source’s Schemas settings.
-
Optional: To enable SSL encryption, extract your database’s SCB archive, get the necessary certificate and keystore files, and then edit the data source’s SSH/SSL settings.
Next steps
After establishing a connection, you can use DataGrip’s features to work with your databases through DataGrip. For more information, see the DataGrip tutorials.
To connect to additional databases, you can create more data sources using the same JDBC driver.