incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: com.datastax.driver.core.exceptions.InvalidQueryException using Datastax Java driver
Date Wed, 24 Apr 2013 02:56:22 GMT
> Can I insert into Column Family (that I created from CLI mode) using Datastax Java driver
or not with Cassandra 1.2.3?
No. 
Create you table using CQL 3 via the cqlsh. 

Cheers

-----------------
Aaron Morton
Freelance Cassandra Consultant
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 23/04/2013, at 6:29 AM, Techy Teck <comptechgeeky@gmail.com> wrote:

> I am using correct keyspace name for that column family. I have verified that as well.
> 
> Can I insert into Column Family (that I created from CLI mode) using Datastax Java driver
or not with Cassandra 1.2.3?
> 
> 
> On Mon, Apr 22, 2013 at 5:05 AM, Internet Group <fsobral@igcorp.com.br> wrote:
> It seems to me that you are not saying the keyspace of your column family 'profile'.
> 
> Regards,
> Francisco.
> 
> 
> On Apr 20, 2013, at 9:56 PM, Techy Teck <comptechgeeky@gmail.com> wrote:
> 
>> I created my column family like this from the CLI-
>> 
>> 
>> create column family profile
>>     with key_validation_class = 'UTF8Type'
>>     and comparator = 'UTF8Type'
>>     and default_validation_class = 'UTF8Type'
>>     and column_metadata = [
>>       {column_name : account, validation_class : 'UTF8Type'}
>>       {column_name : advertising, validation_class : 'UTF8Type'}
>>       {column_name : behavior, validation_class : 'UTF8Type'}
>>       {column_name : info, validation_class : 'UTF8Type'}
>>       ];
>> 
>> 
>> 
>> Now I was trying to insert into this column family using the Datastax Java driver-
>> 
>> 
>> public void upsertAttributes(final String userId, final Map<String, String>
attributes) {
>> 
>> 		
>> String batchInsert = "INSERT INTO PROFILE(id, account, advertising, behavior, info)
VALUES ( '12345', 'hello11', 'bye2234', 'bye1', 'bye2') "; 
>> 
>> 
>> 
>> 
>> 		CassandraDatastaxConnection.getInstance().getSession().execute(batchInsert);
>> 
>> 
>> 	}
>> 
>> I always get this exception-
>> 
>> 
>> 
>> com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured columnfamily
profile
>> 
>> 
>> And by this way, I am trying to create connection/session initialization to Cassandra-
>> 
>> 
>> private CassandraDatastaxConnection() {
>> 
>> 
>> 	try{
>> 	cluster = Cluster.builder().addContactPoint("localhost").build();
>> 	session = cluster.connect("my_keyspace");			
>> 	} catch (NoHostAvailableException e) {
>> 
>> 
>> 
>> 
>> 			throw new RuntimeException(e);
>> 
>> 	}
>> }
>> 
>> I am running Cassandra 1.2.3. And I am able to connect to Cassandra using the above
code. The only problem I am facing is while inserting.
>> 
>> Any idea why it is happening?
>> 
> 
> 


Mime
View raw message