Nijay Dosslin
Nijay Dosslin

Reputation: 31

What is the connection URL to be used for Cassandra?

What is the connection URL to be used for Cassandra?

jdbc:cassandra:root/root@:/

Upvotes: 2

Views: 21040

Answers (1)

Raphael Amoedo
Raphael Amoedo

Reputation: 4465

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);

Upvotes: 6

Related Questions