# Jdbc input plugin doesn't work with prepared statements enabled and large amount of data is proceeding

**URL:** <https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981>\
**Category:** Logstash\
**Created:** [August 22, 2020, 10:46am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981 "2020-08-22T10:46:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![e1m7bo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e1m7bo/32/74356_2.png) [@e1m7bo](https://discuss.elastic.co/u/e1m7bo)\
**Post date:** [August 22, 2020, 10:46am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/1 "2020-08-22T10:46:41Z")

</div>

Before I'll create an issue on [Github](https://github.com/logstash-plugins/logstash-input-jdbc) I'd like to be sure that I'm dealing here with a bug and not with some configuration problem.

I've a task to import data from Oracle database to Elasticsearch. Of course I'm using JDBC input plugin for it.  
Due to performance reasons I need to enable prepared statements for a plugin.  
(It will reduce read operations on DB and will proper index usage)  
My configuration looks as follows:  
` input {`  
` jdbc {`  
` jdbc_fetch_size => 999`  
` schedule => "* * * * *"`  
` use_prepared_statements => true`  
` prepared_statement_name => "foo"`  
` prepared_statement_bind_values => [":sql_last_value"]`  
` statement => " SELECT`  
` ......`  
` FROM table_name tbl`  
` JOIN ......`  
` JOIN ...`  
` LEFT JOIN ......`  
` WHERE tbl.id > ?`  
` "`  
` use_column_value => true`  
` tracking_column => "id"`  
` }`  
` }`

But here I hit a problem. After activating it:

- no events are transmitted in logstash
- no new documents in ELK are created
- CPU usage and memory consumptions is 100%.  
 ![Selection_074](https://us1.discourse-cdn.com/elastic/original/3X/e/8/e8e7021571f0046a2b519c51eff73db4982c0c88.png)
- after some time logstash scrash with following error:  
java.lang.BootstrapMethodError: call site initialization exception

Few important remarks:

- it doesn't matter if I change jdbc\_fetch\_size to smaller or larger value (it only affects how fast memory will be consumed)
- on smaller amount of data everything works fine - documents in ELK indexes are created but with slight delay which doesn't occur when prepared statement are disabled.  
**- when prepared statement are disabled everything works fine even with large data and without any delay:**  
 ![Selection_075](https://us1.discourse-cdn.com/elastic/original/3X/9/6/96b4667a215c9c8fca8b9bcf2459d51f93ad93d2.png)

Am I dealing here with a bug?

---

<div class="post-metadata">

**Author:** ![e1m7bo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e1m7bo/32/74356_2.png) [@e1m7bo](https://discuss.elastic.co/u/e1m7bo)\
**Post date:** [August 24, 2020, 7:59pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/2 "2020-08-24T19:59:28Z")

</div>

> [@e1m7bo](#):
>
> java.lang.BootstrapMethodError: call site initialization exception

I also think this error is not real root cause but only result of out of memory error or something similar.

Did anybody use jdbc plugin, prepared statements and large data volume together?

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 24, 2020, 9:42pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/3 "2020-08-24T21:42:01Z")

</div>

use sql query instead. I have complex query and large record returning

statement\_filepath =\> "/etc/logstash/conf.d/sql/myown.sql"

---

<div class="post-metadata">

**Author:** ![e1m7bo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e1m7bo/32/74356_2.png) [@e1m7bo](https://discuss.elastic.co/u/e1m7bo)\
**Post date:** [August 25, 2020, 7:10am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/4 "2020-08-25T07:10:33Z")

</div>

> [@elasticforme](#):
>
> use sql query instead. I have complex query and large record returning
> 
> statement\_filepath =\> "/etc/logstash/conf.d/sql/myown.sql"

But why it should help? Are prepared statements handled differently if statement is given within the file?

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 25, 2020, 1:25pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/5 "2020-08-25T13:25:05Z")

</div>

you can try to test if your sql has a problem or something else.

also when you use this it is more managable. your config file looks neat and clean.  
your choice

---

<div class="post-metadata">

**Author:** ![e1m7bo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e1m7bo/32/74356_2.png) [@e1m7bo](https://discuss.elastic.co/u/e1m7bo)\
**Post date:** [August 25, 2020, 1:32pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/6 "2020-08-25T13:32:33Z")

</div>

> [@elasticforme](#):
>
> you can try to test if your sql has a problem or something else.
> 
> also when you use this it is more managable. your config file looks neat and clean.  
> your choice

It changes nothing, I can test my SQL also when it is within 'statement' property as well.  
And I do not need to have it neat and clean for now when whole solution is not working for me...

---

<div class="post-metadata">

**Author:** ![elasticforme](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elasticforme](https://discuss.elastic.co/u/elasticforme)\
**Post date:** [August 25, 2020, 1:43pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/7 "2020-08-25T13:43:13Z")

</div>

alright good luck then. you tone is very harsh. people here are to help you on their own will.

---

<div class="post-metadata">

**Author:** ![e1m7bo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e1m7bo/32/74356_2.png) [@e1m7bo](https://discuss.elastic.co/u/e1m7bo)\
**Post date:** [August 26, 2020, 2:49pm UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/8 "2020-08-26T14:49:17Z")

</div>

Small note: I've tested it on two versions 7.8.0 and 7.9.0 - results on both is the same - not working.

Has anyone some other ideas how to help here?

---

<div class="post-metadata">

**Author:** ![e1m7bo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/e1m7bo/32/74356_2.png) [@e1m7bo](https://discuss.elastic.co/u/e1m7bo)\
**Post date:** [August 28, 2020, 9:29am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/9 "2020-08-28T09:29:09Z")

</div>

\*bump (just to not be forgotten and closed)

---

<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:** [September 25, 2020, 9:29am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-doesnt-work-with-prepared-statements-enabled-and-large-amount-of-data-is-proceeding/245981/10 "2020-09-25T09:29:18Z")

</div>

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