- 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.
- In your existing DSE Java driver code, update dependencies to include the DSE Java driver version that can connect to Astra DB databases.
===DataStax Java driver for Apache Cassandra 4.x
- 1
DSE Java 1.x
- 1
- Optional: To use DSE QueryBuilder, which is a utility used to generate CQL queries programmatically, add the following dependency to your pom.xml file:
- 1
- Modify the connection code to use the Astra DB API.In the CqlSession or Session objects ( DseCluster or DseSession objects for DSE), include the path to the secure connect bundle for your Cassandra database (`secure-connect-*database_name*.zip`) in the `withCloudSecureConnectBundle()` method, as shown in the following example.
- 1
Java 1.x
- 1
If converting from using the open source Cassandra Java driver to the DSE Java driver, ensure that you change Session to DseSession .
- Build the project to test the connection.
- 1
If successful, the code builds, compiles, and connects to your Cassandra database.