You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sathwik <in...@gmail.com> on 2017/04/10 14:43:59 UTC

Camel-cassandra component

Hi,

I am trying to query Cassandra Db from camel-context. 

Below is the route:

<route=&quot;test&quot;>
    <to uri="cql://127.0.0.1:9042/empdetails?cql=select * from
employee;&amp;consistencyLevel=quorum"/>
</route>

I have included below dependencies:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-cassandraql</artifactId>
    <version>2.17.1</version>
	</dependency>
	<dependency>
  <groupId>com.datastax.cassandra</groupId>
  <artifactId>cassandra-driver-core</artifactId>
  <version>3.0.0-alpha1</version>
</dependency>

I am facing below exceptions:

by: java.lang.IllegalArgumentException: Prepared statement has only 0
variables, 1 values provided at
com.datastax.driver.core.BoundStatement.bind(BoundStatement.‌​java:140)[556:com.da‌​tastax.driver.core:2‌​.1.5]

Therefore i changed the my route as below:
 <to uri="cql:127.0.0.1:9042/empdetails?cql=select * from employee where
id=2"/>

I am facing below exceptions:
com.datastax.driver.core.exceptions.InvalidQueryException: Invalid amount of
bind variables
    at
com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java

Please let me know the cause for this issue.

Thanks,
sathwik






--
View this message in context: http://camel.465427.n5.nabble.com/Camel-cassandra-component-tp5797319.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel-cassandra component

Posted by Tomohisa Igarashi <tm...@gmail.com>.
Hi,

According to the doc and code message body is used as query parameters in camel-cassandrasql
http://camel.apache.org/cassandra.html
https://github.com/apache/camel/blob/master/components/camel-cassandraql/src/main/java/org/apache/camel/component/cassandra/CassandraProducer.java#L75

So you may need to send a null/empty body when using static cql.

Thanks,
Tomo


On 04/10/2017 11:43 PM, sathwik wrote:
> Hi,
>
> I am trying to query Cassandra Db from camel-context.
>
> Below is the route:
>
> <route=&quot;test&quot;>
>     <to uri="cql://127.0.0.1:9042/empdetails?cql=select * from
> employee;&amp;consistencyLevel=quorum"/>
> </route>
>
> I have included below dependencies:
>
> <dependency>
>     <groupId>org.apache.camel</groupId>
>     <artifactId>camel-cassandraql</artifactId>
>     <version>2.17.1</version>
> 	</dependency>
> 	<dependency>
>   <groupId>com.datastax.cassandra</groupId>
>   <artifactId>cassandra-driver-core</artifactId>
>   <version>3.0.0-alpha1</version>
> </dependency>
>
> I am facing below exceptions:
>
> by: java.lang.IllegalArgumentException: Prepared statement has only 0
> variables, 1 values provided at
> com.datastax.driver.core.BoundStatement.bind(BoundStatement.\u200c\u200bjava:140)[556:com.da\u200c\u200btastax.driver.core:2\u200c\u200b.1.5]
>
> Therefore i changed the my route as below:
>  <to uri="cql:127.0.0.1:9042/empdetails?cql=select * from employee where
> id=2"/>
>
> I am facing below exceptions:
> com.datastax.driver.core.exceptions.InvalidQueryException: Invalid amount of
> bind variables
>     at
> com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java
>
> Please let me know the cause for this issue.
>
> Thanks,
> sathwik
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-cassandra-component-tp5797319.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>