2011-03-29 63 views
1

我試圖建立一個POC,其中後端是卡桑德拉和前端是J2EE所需要的任何驅動程序jar。我已經將可用於cassandra lib文件夾的jar文件添加到我的java id(eclipse)中。但是,在這種情況下,有幾種API方法沒有得到認可!有連接到數據庫卡桑德拉

是否有卡桑德拉需要被添加爲Oracle或Sybase的情況下,任何驅動程序jar?

回答

0

你爲什麼不嘗試赫克託: https://github.com/rantav/hector

import me.prettyprint.cassandra.serializers.StringSerializer; 
import me.prettyprint.cassandra.service.CassandraHostConfigurator; 
import me.prettyprint.hector.api.Cluster; 
import me.prettyprint.hector.api.Keyspace; 
import me.prettyprint.hector.api.beans.HColumn; 
import me.prettyprint.hector.api.factory.HFactory; 
import me.prettyprint.hector.api.mutation.MutationResult; 
import me.prettyprint.hector.api.mutation.Mutator; 
import me.prettyprint.hector.api.query.ColumnQuery; 
import me.prettyprint.hector.api.query.QueryResult; 

// sample connect method in Java 
private static void connect() { 
    Cluster cluster; 
    Keyspace keyspace; 
    StringSerializer se = new StringSerializer(); 
    cluster = HFactory.getOrCreateCluster("TestCluster", new CassandraHostConfigurator("localhost:9160")); 
    keyspace = HFactory.createKeyspace("Twissandra", cluster); 
    Mutator<String> mutator = HFactory.createMutator(keyspace, se) 
    MutationResult rs = mutator.insert("some-name-key", "User", 
    HFactory.createStringColumn("first", "some value"));