简体   繁体   中英

What is the connection URL to be used for Cassandra?

What is the connection URL to be used for Cassandra?

jdbc:cassandra:root/root@:/

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM