What is the connection URL to be used for Cassandra?

19.3k views Asked by At

What is the connection URL to be used for Cassandra?

jdbc:cassandra:root/root@:/

1

There are 1 answers

3
Raphael Amoedo On

If you're using cassandra-jdbc, the connection URL will be something like this:

jdbc:cassandra://host1--host2--host3:9160/keyspace1?primarydc=DC1&backupdc=DC2&consistency=QUORUM"

But if you do not have to use JDBC, I recommend you the DataStax Java-Driver. You will connect like this:

String serverIP = "127.0.0.1";
String keyspace = "system";

Cluster cluster = Cluster.builder()
.addContactPoints(serverIP)
.build();

Session session = cluster.connect(keyspace);