小编Ale*_*ite的帖子

Cassandra被打破了还是我犯了一个大错?

我和Cassandra工作了很多,感觉我多年来已经从数据库中拿出了足够的BS.只是想知道为什么这不适用于数据存储java驱动程序的Apache Cassandra 2.1.0(或2.0.8)w/2.1.1.看起来这应该是有用的.

public class BS {

    public static void main(String [] args) {
           Cluster cluster = Cluster.builder().addContactPoint("192.168.1.6").build();
           Metadata metadata = cluster.getMetadata();
           System.out.printf("Connected to cluster: %s\n", metadata.getClusterName());
           Session session = cluster.connect();

           session.execute("CREATE KEYSPACE IF NOT EXISTS fook WITH replication= {'class':'SimpleStrategy', 'replication_factor':1 }");
           session.execute("CREATE TABLE IF NOT EXISTS fook.dooftbl (id bigint PRIMARY KEY, doof text, ownerid bigint)");

           long id = new Random().nextLong();
           long ownerid = new Random().nextLong();
           String doof = "broken db";

           String load = "INSERT INTO fook.dooftbl (id,doof,ownerid) VALUES (?,?,?)"; …
Run Code Online (Sandbox Code Playgroud)

java cassandra nosql datastax

-3
推荐指数
1
解决办法
1203
查看次数

标签 统计

cassandra ×1

datastax ×1

java ×1

nosql ×1