Getting Started with Apache Cassandra and Java cluster = Cluster.builder().addContactPoint("127.0.0.1...

Please Visit: http://ift.tt/1ajReyV



Getting Started with Apache Cassandra and Java

cluster = Cluster.builder().addContactPoint("127.0.0.1").build();

session = cluster.connect("demo");

session.execute("INSERT INTO users (lastname, age, city, email, firstname) VALUES ('Jones', 35, 'Austin', 'bob@example.com','Bob')");



ResultSet results = session.execute("SELECT * FROM users WHERE lastname='Jones'");

for (Row row : results) {

System.out.format("%s %d\n", row.getString("firstname"), row.getInt("age"));

}

cluster.close();



.withRetryPolicy(DefaultRetryPolicy.INSTANCE)

.withLoadBalancingPolicy(new TokenAwarePolicy(new DCAwareRoundRobinPolicy()))



http://ift.tt/1vzCwUB

http://ift.tt/1H0ehmt






from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1Ji934J

via LifeLong Community

No comments:

Post a Comment