我試圖建立一個POC,其中後端是卡桑德拉和前端是J2EE所需要的任何驅動程序jar。我已經將可用於cassandra lib文件夾的jar文件添加到我的java id(eclipse)中。但是,在這種情況下,有幾種API方法沒有得到認可!有連接到數據庫卡桑德拉
是否有卡桑德拉需要被添加爲Oracle或Sybase的情況下,任何驅動程序jar?
我試圖建立一個POC,其中後端是卡桑德拉和前端是J2EE所需要的任何驅動程序jar。我已經將可用於cassandra lib文件夾的jar文件添加到我的java id(eclipse)中。但是,在這種情況下,有幾種API方法沒有得到認可!有連接到數據庫卡桑德拉
是否有卡桑德拉需要被添加爲Oracle或Sybase的情況下,任何驅動程序jar?
你不需要在你的J2EE卡桑德拉罐子。官方客戶端API是節儉,這裏有一個關於如何使用節儉連接Java示例 - http://wiki.apache.org/cassandra/ThriftExamples
有可用於儲蓄與卡桑德拉連接數Java包裝(如節儉API是不是很方便)。 其中我強烈推薦赫克託 - http://prettyprint.me/2010/02/23/hector-a-java-cassandra-client/
你爲什麼不嘗試赫克託: 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"));