Hi,
After creating the keyspace successfully now i want to know how to read write 
data using API,s

Regards
Arshad
________________________________
From: Filippo Diotalevi [fili...@ntoklo.com]
Sent: Wednesday, June 06, 2012 2:27 PM
To: user@cassandra.apache.org
Subject: Re: Query

Hi,
the Javadoc (or source code) of the me.prettyprint.hector.api.factory.HFactory 
class contains all the examples to create keyspaces and column families.

To create a keyspace:

String testKeyspace = "testKeyspace";
KeyspaceDefinition newKeyspace = 
HFactory.createKeyspaceDefinition(testKeyspace);
cluster.addKeyspace(newKeyspace);


To create a column family and a keyspace:

String keyspace = "testKeyspace";
String column1 = "testcolumn";
ColumnFamilyDefinition columnFamily1 = 
HFactory.createColumnFamilyDefinition(keyspace, column1);
List<ColumnFamilyDefinition> columns = new ArrayList<ColumnFamilyDefinition>();
columns.add(columnFamily1);

KeyspaceDefinition testKeyspace =
HFactory.createKeyspaceDefinition(keyspace, 
org.apache.cassandra.locator.SimpleStrategy.class.getName(), 1, columns);
cluster.addKeyspace(testKeyspace);

--
Filippo Diotalevi



On Wednesday, 6 June 2012 at 07:05, MOHD ARSHAD SALEEM wrote:

Hi All,

I am using Hector client for cassandra . I wanted to know how to create 
keyspace and column family using API's to read and write data.
or  i have to create keyspace and column family manually using command line 
interface.

Regards
Arshad

Reply via email to