# Error with JDBC statement on MaxDB

**URL:** <https://discuss.elastic.co/t/error-with-jdbc-statement-on-maxdb/285392>\
**Category:** Logstash\
**Created:** [September 28, 2021, 4:26pm UTC](https://discuss.elastic.co/t/error-with-jdbc-statement-on-maxdb/285392 "2021-09-28T16:26:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![franckfct](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/franckfct/32/81235_2.png) [@franckfct](https://discuss.elastic.co/u/franckfct)\
**Post date:** [September 28, 2021, 4:26pm UTC](https://discuss.elastic.co/t/error-with-jdbc-statement-on-maxdb/285392/1 "2021-09-28T16:26:51Z")

</div>

Hi,

I would like to synchronize a MaxDB table to ES via logstash/JDBC, so in my pipeline i have =\>

```auto

input {
  jdbc {
    jdbc_driver_library => "<path>/sapdbc.jar"
    jdbc_driver_class => "com.sap.dbtech.jdbc.DriverSapDB"
    jdbc_connection_string => "jdbc:sapdb://ip:7200/schema"
    jdbc_user => "User"
    jdbc_password => "passwd"
    jdbc_paging_enabled => true
    jdbc_validate_connection => true
    clean_run => true
    tracking_column => "unix_ts_in_secs"
    use_column_value => true
    tracking_column_type => "numeric"
    schedule => "*/1 * * * *"
    statement => "SELECT OBJECT_ID FROM TABLE"
    jdbc_page_size => 100000 
    jdbc_paging_enabled => true
    last_run_metadata_path => "/.logstash_jdbc_last_run"
  }
}

```

and i received this error:

```auto
[2021-09-28T18:13:00,189][ERROR][logstash.inputs.jdbc][pipeline_ticket][a0519e841cc0d8e39dde3bdea12d077f54b35d4948173191186898141d83a875] Java::ComSapDbtechJdbcExceptionsJdbc40::SQLSyntaxErrorException: [-3008] (at 77): Invalid keyword or missing delimiter: SELECT * FROM (SELECT OBJECT_ID FROM TABLE) AS "T1" LIMIT 100000 OFFSET 0
[2021-09-28T18:13:00,192][WARN][logstash.inputs.jdbc][pipeline_ticket][a0519e841cc0d8e39dde3bdea12d077f54b35d4948173191186898141d83a875] Exception when executing JDBC query {:exception=>"Java::ComSapDbtechJdbcExceptionsJdbc40::SQLSyntaxErrorException: [-3008] (at 77): Invalid keyword or missing delimiter"}

```

So i tested directly from maxdb client with and without "LIMIT 100000 OFFSET 0"

without LIMIT and OFFSET =\> SELECT \* FROM (SELECT OBJECT\_ID FROM TABLE)  
Good result

```auto
user@hostname:/home/user> 
| OBJECT_ID |
| ---------- |
| 8000000000 |
| 8000000001 |
| 8000000002 |
| 8000000003 |
| 8000000004 |

```

With LIMIT and OFFSET =\> SELECT \* FROM (SELECT OBJECT\_ID FROM TABLE) LIMIT 100000 OFFSET 0

```auto
user@hostname:/home/user> * -3008: POS(69) Invalid keyword or missing delimiter SQLSTATE: 42000

```

Position 69 coresponding to OFFSET word

How can i solve this issue or remove offset word from the statement ?

Thanks

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [September 28, 2021, 4:55pm UTC](https://discuss.elastic.co/t/error-with-jdbc-statement-on-maxdb/285392/2 "2021-09-28T16:55:09Z")

</div>

> [@franckfct](#):
>
> How can i solve this issue or remove offset word from the statement ?

The jdbc input is built on top of Jeremy Evans' [sequel](https://github.com/jeremyevans/sequel#sequel-the-database-toolkit-for-ruby-) library. Its [pagination code](https://github.com/jeremyevans/sequel/blob/c920bd2b726c43045f5f6e80f869f5eda3ce71b3/lib/sequel/dataset/actions.rb#L545) assumes the underlying database uses LIMIT and OFFSET to control this. If your DB does not support that then you cannot use pagination.

Try removing both of your `jdbc_paging_enabled => true` options on the input.

---

<div class="post-metadata">

**Author:** ![franckfct](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/franckfct/32/81235_2.png) [@franckfct](https://discuss.elastic.co/u/franckfct)\
**Post date:** [September 28, 2021, 7:43pm UTC](https://discuss.elastic.co/t/error-with-jdbc-statement-on-maxdb/285392/3 "2021-09-28T19:43:09Z")

</div>

Yes, Exactly. Thanks a lot

---

<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:** [October 26, 2021, 7:43pm UTC](https://discuss.elastic.co/t/error-with-jdbc-statement-on-maxdb/285392/4 "2021-10-26T19:43:25Z")

</div>

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