2011-03-29 4 views

답변

1

j2ee에는 cassandra jars가 필요하지 않습니다. 공식 클라이언트 측 API는 드리프트이며, 여기에 사용 중고품을 연결하는 방법에 대한 자바 예제 - http://wiki.apache.org/cassandra/ThriftExamples

카산드라와 연결 드리프트에 사용할 수있는 몇 가지 자바 래퍼가 (드리프트 API는 친절한 매우 사용자가 아니므로). - 내가보기 엔 헥터을 추천 할 수 있습니다 그 중 http://prettyprint.me/2010/02/23/hector-a-java-cassandra-client/

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")); 
관련 문제