# Error with Cassandra and jdbc\_paging\_enabled =\> true

**URL:** <https://discuss.elastic.co/t/error-with-cassandra-and-jdbc-paging-enabled-true/117616>\
**Category:** Logstash\
**Created:** [January 30, 2018, 12:37pm UTC](https://discuss.elastic.co/t/error-with-cassandra-and-jdbc-paging-enabled-true/117616 "2018-01-30T12:37:05Z")\
**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 30, 2018, 12:37pm UTC](https://discuss.elastic.co/t/error-with-cassandra-and-jdbc-paging-enabled-true/117616/1 "2018-01-30T12:37:05Z")

</div>

Hi,  
I use Logstash with jdbc plugin and Cassandra.

Elasticsearch: 6.1.2  
logstash-input-jdbc: 4.3.3  
Cassandra: 3.11.1  
Jdbc driver: dbschema.CassandraJdbcDriver

This is my config:  
input {  
jdbc {  
clean\_run =\> "false"  
jdbc\_connection\_string =\> "jdbc:cassandra://0.0.0.0:9042"  
jdbc\_user =\> "myuser"  
jdbc\_password =\> "mypass"  
jdbc\_driver\_library =\> "/home/logstash\_driver/CassandraDBSchema/cassandrajdbc1.1.jar"  
jdbc\_driver\_class =\> "com.dbschema.CassandraJdbcDriver"  
statement =\> "select \* from mydatabase.products\_to\_elastic WHERE lastmodified \> :sql\_last\_value ALLOW FILTERING"  
jdbc\_paging\_enabled =\> "true"  
jdbc\_page\_size =\> "50000"  
schedule =\> "\* \* \* \* \*"  
tracking\_column =\> "lastmodified"  
tracking\_column\_type =\> "timestamp"  
record\_last\_run =\> "true"  
sql\_log\_level =\> "info"  
jdbc\_default\_timezone =\> "UTC"  
}  
}

I have this error when i enable pagination:

[2018-01-30T12:53:03,090][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 mydatabase.products\_to\_elastic WHERE lastmodified \> '2018-01-30 11:59:02.709784' ALLOW FILTERING) AS "T1" LIMIT 1  
[2018-01-30T12:53:03,097][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 [(]...)\>}

Is possible than other DB support this query, but with Cassandra it doesn't work.

If I set jdbc\_paging\_enabled =\> "false"

I don't have this error, but I obtain another error:

[2018-01-30T13:31:00,462][ERROR][logstash.inputs.jdbc] Java::ComDatastaxDriverCoreExceptions::InvalidQueryException: Unable to coerce '2018-01-30 11:59:02.709784' to a formatted date (long): select \* from mydatabase.products\_to\_elastic WHERE lastmodified \> '2018-01-30 11:59:02.709784' ALLOW FILTERING  
[2018-01-30T13:31:00,464][WARN][logstash.inputs.jdbc] Exception when executing JDBC query {:exception=\>#\<Sequel::DatabaseError: Java::ComDatastaxDriverCoreExceptions::InvalidQueryException: Unable to coerce '2018-01-30 11:59:02.709784' to a formatted date (long)\>}

It seems that the cassandra date and logstash are not compatible.  
If I try this query directly on Cassandra doesn't work: ( select \* from mydatabase.products\_to\_elastic WHERE lastmodified \> '2018-01-30 11:59:02.709784' ALLOW FILTERING )

If I change the date format it works well: (select \* from mydatabase.products\_to\_elastic WHERE lastmodified \> '2018-01-30 11:59:02.709' ALLOW FILTERING )

'2018-01-30 11:59:02.709784' -\> '2018-01-30 11:59:02.709'

I try to use filters to change the data, but filter works with data after the input.  
it's possible that I have to change any jdbc configurations, but I don't know where.

---

<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 27, 2018, 12:37pm UTC](https://discuss.elastic.co/t/error-with-cassandra-and-jdbc-paging-enabled-true/117616/2 "2018-02-27T12:37:26Z")

</div>

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