cassandra-thrift-1.1.2.jar
問題コード:
ColumnOrSuperColumn cosc = null;
org.apache.cassandra.thrift.Column c = 新しい org.apache.cassandra.thrift.Column ();
c.setName ("full_name".getBytes ("UTF-8"));
c.setValue ("テスト名".getBytes ("UTF-8"));
c.setTimestamp (System.currentTimeMillis());
// データを挿入
// 長いタイムスタンプ = System.currentTimeMillis();
試す {
client.set_keyspace("CClient");
bb=ByteBuffer.allocate (10);
client.insert (bb.putInt(1),
新しい ColumnParent (「ユーザー」)、
c、
ConsistencyLevel.QUORUM);
bb.putInt (2);
cosc = client.get (bb, cp, ConsistencyLevel.QUORUM);
}
catch (TimedOutException toe) {
System.out.println (toe.getMessage());
}
catch (org.apache.cassandra.thrift.UnavailableException e) {
// TODO 自動生成された catch ブロック
e.printStackTrace();
}
キャッチ (例外 e) {
e.printStackTrace();
}
最後に {
System.out.println (新しい文字列 (cosc.getColumn().getName()) + "-" + 新しい文字列 (cosc.getColumn().getValue()));
}
上記のコードは、ジャンクまたは null をデータベースに挿入しますが、その理由がわかりません。
CLI でどのように表示されるかを確認します。
行キー: => (列 = フルネーム、値 = テスト名、タイムスタンプ = 1345743985973)
これについての助けは大歓迎です。
ありがとう。