Cassandra Connection String Generator

Generate connection snippets for Apache Cassandra in any driver. Java, Python, Node.js, Go, .NET, cqlsh, and more.

Client-side only — nothing leaves your browser

cqlsh localhost 9042 -k mykeyspace

What is a Cassandra Connection String?

Unlike relational databases, Apache Cassandra does not use a single URI connection string. Each driver has its own configuration API based on contact points (cluster node addresses), port, keyspace, and authentication credentials. This generator builds the correct driver-specific connection snippet for your language.

Authentication Options

  • No auth — Default for local development; AllowAllAuthenticator in cassandra.yaml
  • Username / Password — PasswordAuthenticator; default credentials are cassandra/cassandra
  • SSL / TLS — Encrypts client-to-node traffic; configure certificates in cassandra.yaml and driver settings

Quick Reference

DriverExample Pattern
cqlsh (CLI)cqlsh host 9042 -u user -p pass -k keyspace --ssl
Java (DataStax)CqlSession.builder().addContactPoint(...).withKeyspace("ks").build()
Python (cassandra-driver)Cluster(["host"], port=9042).connect("ks")
Node.js (cassandra-driver)new Client({ contactPoints: ["host"], localDataCenter: "dc1" })
Go (gocql)gocql.NewCluster("host"); cluster.Keyspace = "ks"
.NET (CSharpDriver)Cluster.Builder().AddContactPoint("host").WithPort(9042).Build()
PHPCassandra::cluster()->withContactPoints("host")->build()->connect("ks")
RubyCassandra.cluster(hosts: ["host"]).connect("ks")

Frequently Asked Questions

What is a Cassandra connection string and how does it differ from SQL databases?
Unlike PostgreSQL or MySQL, Apache Cassandra does not have a single standardized connection URI format. Instead, each driver uses its own configuration approach based on contact points (one or more cluster node addresses), a port, an optional keyspace, and authentication credentials. The concept of 'contact points' replaces a single host because Cassandra is a distributed database where any node can serve as an entry point to the cluster.
What is the difference between a Cassandra JDBC connection string and a native driver connection?
A Cassandra JDBC connection string (e.g., jdbc:cassandra://host:9042/keyspace) is used by JDBC wrappers that adapt the relational JDBC API for Cassandra. Native drivers — like the DataStax Java Driver, Python cassandra-driver, or Node.js cassandra-driver — connect directly using Cassandra's binary protocol, offering better performance, async support, and access to Cassandra-specific features like tunable consistency and token-aware routing.
How do I connect to Cassandra with SSL/TLS enabled?
Enabling SSL/TLS varies by driver. In cqlsh, add the --ssl flag and configure the [ssl] section in cqlshrc. In the Java DataStax driver, build an SSLContext and pass it via withSslContext() on the session builder. In Python, pass ssl_context or ssl_options to the Cluster constructor. In Node.js, set the sslOptions property in the Client configuration. Most production Cassandra deployments require SSL for encryption in transit — check your cluster's configuration to determine if client-to-node encryption is enabled.
How do I connect to Cassandra in Docker?
From the host machine, use localhost with the mapped port (e.g., localhost:9042 if you mapped -p 9042:9042). From another container on the same Docker network, use the container name as the contact point (e.g., cassandra-node:9042). In Docker Compose, use the service name as the hostname. By default, the official Cassandra Docker image has no authentication — set CASSANDRA_AUTHENTICATOR=PasswordAuthenticator and CASSANDRA_AUTHORIZER=CassandraAuthorizer environment variables to enable it.
Why do I get 'connection refused' on port 9042 when connecting to Cassandra?
A connection refused error on port 9042 usually means Cassandra is not yet listening for CQL clients. Common causes: the node is still bootstrapping (Cassandra can take 30-60 seconds to start), the native_transport is disabled in cassandra.yaml, the listen_address or rpc_address is misconfigured, or a firewall is blocking the port. Check 'nodetool status' to verify the node is UN (Up/Normal), and confirm native_transport_port is 9042 in cassandra.yaml. For Docker, ensure the container has fully started before attempting connections.
Cassandra

Need a Cassandra GUI Client?

1bench is a modern database client for Cassandra and 20+ other databases. Query, browse, and manage your data visually.

Learn More