Connecting an external application
IBM Cloud® Databases for DataStax is deprecated and no longer supported as of 30 June 2024. For more information, see the deprecation details.
Your applications and drivers use connection strings to make a connection to IBM Cloud® Databases for DataStax. The service provides connection strings specifically for drivers and applications. Connection strings are displayed in the Endpoints pane of your deployment's Overview, and can also be retrieved from the cloud databases CLI plug-in, and the API.
The connection strings can be used by any of the credentials you created on your deployment. While you can use the admin user for all of your connections and applications, it might be better to create users specifically for your applications to connect with. Documentation on generating credentials is on the Getting Connection Strings page.
Connecting to a Databases for DataStax deployment:
- Use the
<formation_id>_<endpoint_type>.zip
file from Getting Connection Strings to set up a connection. This file contains the metadata that is required to connect to your Databases for DataStax services including connection strings and self-signed certificates. It does not contain credentials. - Select and install a supported driver from the list in table 1.
- The driver communicates with the metadata service to retrieve the endpoint
- The driver automatically connects to the appropriate endpoint
Connecting with a language's driver
Drivers are a key component to connecting external applications to your Databases for DataStax deployment. The following table outlines the drivers that are available from DataStax for this type of connection:
DataStax Drivers | Databases for DataStax connection capable |
---|---|
C/C++ driver |
Yes |
C# driver |
Yes |
Java driver |
Yes |
Node.js driver |
Yes |
Python driver |
Yes |
More details on these drivers, including upgrade guides, can be found on the Developing applications with Apache Cassandra and DataStax Enterprise page.
Nodetool, and other drivers that are not explicitly stated in the connection capable table, are not supported by Databases for DataStax. Only Datastax Enterprise (DSE)
drivers are supported for use with Databases for DataStax.
Connecting by using CQLSH
The Cassandra Query Language SHell (CQLSH) is a shell that uses the Cassandra Query Language (CQL) to interact with your database. You can use CQLSH to interact with your database through CQL commands:
./bin/cqlsh -u username -p password -b /path/to/secure-connectdatabase_name.zip
See the following DataStax documentation to get started with CQL:
Connecting with Java
Review the GitHub repository for DataStax-Examples specific to Getting Started with Apache Cassandra and Java by using DataStax Astra
Connecting with Python
Review the GitHub repository for DataStax-Examples specific to Getting Started with Apache Cassandra and Python by using DataStax Astra
Driver TLS and self-signed certificate support
All connections to Databases for DataStax are TLS 1.2 enabled, so the driver you use to connect needs to be able to support encryption. Your deployment also comes with a self-signed certificate (provided in the secure connect bundle downloadable from the Connections pane), so the driver can verify the server upon connection.
Using the self-signed certificate
-
Download the secure connect bundle compressed file from the Endpoints pane of the endpoint information. (You can use the Name that is provided or your own file name).
-
Provide the path to the compressed file that contains the certificate to the CQLSH command to connect the driver or client:
./bin/cqlsh -u admin -p <password> -b /<path_to_secure-connect-bundle.zip>
CLI plug-in support for the self-signed certificate
You can display the decoded certificate for your deployment with the CLI plug-in with the command ibmcloud cdb deployment-cacert "your-service-name"
. It decodes the base64 into text. Copy and save the command's output
to a file and provide the file's path to the driver.