# Teradata JDBC Pagination

**URL:** <https://discuss.elastic.co/t/teradata-jdbc-pagination/87014>\
**Category:** Logstash\
**Created:** [May 24, 2017, 4:38pm UTC](https://discuss.elastic.co/t/teradata-jdbc-pagination/87014 "2017-05-24T16:38:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennifer.elyse](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@jennifer.elyse](https://discuss.elastic.co/u/jennifer.elyse)\
**Post date:** [May 24, 2017, 4:38pm UTC](https://discuss.elastic.co/t/teradata-jdbc-pagination/87014/1 "2017-05-24T16:38:02Z")

</div>

I am new to the Elastic Stack. I'm using Logstash to load data from Teradata into ElastiSearch. I want to implement jdbc\_paging\_enabled, but Logstash is wrapping my sql statement in a SELECT count(\*) AS "COUNT" FROM () AS "T1" LIMIT 1. This is throwing an exception:  
[2017-05-24T10:33:00,377][WARN][logstash.inputs.jdbc] Exception when executing JDBC query {:exception=\>#\<Sequel::DatabaseError: Java::JavaSql::SQLException: [Teradata Database] [TeraJDBC 14.10.00.44] [Error 3706] [SQLState 42000] Syntax error: expected something between the word 'T1' and the 'LIMIT' keyword.\>}  
The query executes fine without the LIMIT 1. Is there an option that I need to have enabled for the query to be wrapped properly?  
jdbc\_driver\_library =\> "/dha/download/terajdbc4.jar,/dha/download/tdgssconfig.jar"  
jdbc\_driver\_class =\> "com.teradata.jdbc.TeraDriver"  
jdbc\_connection\_string =\> "jdbc:teradata://\<database\_domain\>/DATABASE=\<database\_name\>"  
jdbc\_validate\_connection =\> true  
jdbc\_user =\> "\<username\>"  
jdbc\_password =\> "\<password\>"  
jdbc\_fetch\_size =\> 200000  
jdbc\_paging\_enabled =\> true  
jdbc\_page\_size =\> 200000  
clean\_run =\> false

Please see Result limits:

> **[Select (SQL)](https://en.wikipedia.org/wiki/Select_(SQL)#Result_limits)**
>
> The SQL SELECT statement returns a result set of records from one or more tables. A SELECT statement retrieves zero or more rows from one or more database tables or database views. In most applications, SELECT is the most commonly used data query language (DQL) command. As SQL is a declarative programming language, SELECT queries specify a result set, but do not specify how to calculate it. The database translates the query into a "query plan" which may vary between executions, database versions ...

Teradata uses keyword TOP and SAMPLE

---

<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:** [June 21, 2017, 4:38pm UTC](https://discuss.elastic.co/t/teradata-jdbc-pagination/87014/2 "2017-06-21T16:38:06Z")

</div>

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