Sanil GK
Sanil GK

Reputation: 31

me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(mismatched input '(' expecting ')')

I am trying to insert some values in table 'standardevents'. This is the query that is executed.

    UUID uuid=new UUID();
    CqlQuery<String,String,String> cqlQuery = new CqlQuery<String,String,String>(keyspace, stringSerializer, stringSerializer, stringSerializer);   
    cqlQuery.setQuery("INSERT INTO standardevents (UUID,time, tracker, type, name, userID, data) VALUES ("+uuid+",dateof(now()),'"+sessId+"', '"+type+"','"+name+"', '"+userid+"','"+data+"')");
    QueryResult<CqlRows<String,String,String>> result = cqlQuery.execute();     

I prints the query before executing,I get

INSERT INTO standardevents (UUID,time, tracker, type, name, userID, data) VALUES (e1319140-4acd-11e3-8015-842b2bab8f61,dateof(now()),'B2FD2CF496E31EC75C33F7A3D55BB800', 'user','coursepage_view', '81','{"courseID":68,"courseDesc":"Quick Start"}')

After Executing I get an excepion

     me.prettyprint.hector.api.exceptions.HInvalidRequestException:
InvalidRequestException(why:line 1:125 mismatched input '(' expecting ')')

But,Values are inserted when i run this query in cqlsh client. Thanks in advance.

Upvotes: 2

Views: 524

Answers (1)

jbellis
jbellis

Reputation: 19377

Hector's CQL is poorly supported and buggy. You should use the native CQL Java driver instead: https://github.com/datastax/java-driver

Upvotes: 1

Related Questions