# Query error with JDBC with cassandra input

**URL:** <https://discuss.elastic.co/t/query-error-with-jdbc-with-cassandra-input/117222>\
**Category:** Logstash\
**Created:** [January 26, 2018, 3:59pm UTC](https://discuss.elastic.co/t/query-error-with-jdbc-with-cassandra-input/117222 "2018-01-26T15:59:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nomedx](https://avatars.discourse-cdn.com/v4/letter/n/f4b2a3/32.png) [@nomedx](https://discuss.elastic.co/u/nomedx)\
**Post date:** [January 26, 2018, 3:59pm UTC](https://discuss.elastic.co/t/query-error-with-jdbc-with-cassandra-input/117222/1 "2018-01-26T15:59:41Z")

</div>

Hi,  
I have a problem with logstash jdbc plugin (I use dbschema.CassandraJdbcDriver) and cassandra. When I start logstash I obtain always this error in logstash logs:

[ERROR][logstash.inputs.jdbc] Java::ComDatastaxDriverCoreExceptions::SyntaxError: line 1:32 no viable alternative at input '(' (...(_) AS "COUNT" FROM [(]...): SELECT count(_) AS "COUNT" FROM (SELECT \* FROM database.products ) AS "T1" LIMIT 1

[2018-01-26T16:54:02,724][WARN][logstash.inputs.jdbc] Exception when executing JDBC query {:exception=\>#\<Sequel::DatabaseError: Java::ComDatastaxDriverCoreExceptions::SyntaxError: line 1:32 no viable alternative at input '(' (...(\*) AS "COUNT" FROM [(]...)\>}

this is my config input:

```
  clean_run => "true"
  jdbc_driver_library => "/home/logstash_driver/CassandraDBSchema/cassandrajdbc1.1.jar" 
  jdbc_driver_class => "com.dbschema.CassandraJdbcDriver" 
  statement => "SELECT * FROM database.products " # Your query
  jdbc_paging_enabled => "true"
  jdbc_page_size => "50000"
  schedule => "* * * * *"
  sql_log_level => "info"

```

While I was testing I noticed that when I active pagination ( jdbc\_paging\_enabled =\> "true" )  
jdbc plugin adds a query count to my query:

SELECT count(\*) AS "COUNT" FROM (SELECT \* FROM database.products ) AS "T1" LIMIT 1

and Cassandra doesn't support this subquery.

I thought about solving with a limit in the query statement: SELECT \* FROM database.products LIMIT 10000  
and disabled jdbc paging ( jdbc\_paging\_enabled =\> "false").

But it doesn't seem a good solution, another solution?  
Many thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 23, 2018, 4:20pm UTC](https://discuss.elastic.co/t/query-error-with-jdbc-with-cassandra-input/117222/3 "2018-02-23T16:20:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
