# Logstash 7.2.0 input jdbc plugin restarts itself and inserts data continuously in elastic

**URL:** <https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966>\
**Category:** Logstash\
**Created:** [August 6, 2020, 6:22am UTC](https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966 "2020-08-06T06:22:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![VinayM30](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinaym30/32/73420_2.png) [@VinayM30](https://discuss.elastic.co/u/VinayM30)\
**Post date:** [August 6, 2020, 6:22am UTC](https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966/1 "2020-08-06T06:22:40Z")

</div>

I am trying to import data from oracle db to elastic search, the process is happening with logstash in windows but when i run the same in a unix box it fetches the data from table then says [Error] [logstash.javapipeline] A plugin had an unrecoverable error. Will restart this plugin.  
Pipeline\_id:main  
Plugin: \<Logstash::Inputs::Jdbc jdbc\_user=\>""...

Error: No such file or directory --/.logstash\_jdbc\_last\_run  
Exception: Errno::ENOENT  
Stack: org/jruby/RubyIO.java:1236:in `sysopen' org/jruby/RubyIO.java:3796:in `write'

Conf file:

```auto
    input {
         jdbc {
            jdbc_connection_string => 'jdbc:oracle:thin:@<host>:<port>/<service name>'
            jdbc_user => '<user>'
            jdbc_password=>'<DBpassword>'
            jdbc_driver_library=>'<absolute path to ojdbc8.jar>'
            jdbc_driver_class=>'Java::oracle.jdbc.OracleDriver'
            statement => 'select * from mytable'
        }
    }
    output {
        stdout {
             codec => json_lines
        }
    }

```

I didnot understand the points that with the same downloaded logstash-7.2.0 why the same conf file runs good on windows while it runs in an infinite loop in unix RHEL 7 server boxes

---

<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:** [August 6, 2020, 2:02pm UTC](https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966/2 "2020-08-06T14:02:13Z")

</div>

You are relying on the default path for the last run metadata.

```auto
config :last_run_metadata_path, :validate => :string, :default => "#{ENV['HOME']}/.logstash_jdbc_last_run"

```

I suggest you set it explicitly.

---

<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 6, 2020, 2:08pm UTC](https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966/3 "2020-08-06T14:08:36Z")

</div>

> [@VinayM30](#):
>
> `jdbc_driver_library=>'<absolute path to ojdbc8.jar>'`

you don't need this line. this is causing a problem.  
copy ojdbc8.jar to "/usr/share/logstash/logstash-core/lib/jars/ojdbc8.jar"  
also add "clean\_run=\>true" in your conf file and it will not use that .logstash\_jdbc\_last\_run

---

<div class="post-metadata">

**Author:** ![VinayM30](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinaym30/32/73420_2.png) [@VinayM30](https://discuss.elastic.co/u/VinayM30)\
**Post date:** [August 7, 2020, 6:57am UTC](https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966/4 "2020-08-07T06:57:23Z")

</div>

Thanks Badger, I have tried to set it explicitly and now it is working. Don't know if restarting logstash again and again is a bug from logstash.

Anyways thanks Badger

---

<div class="post-metadata">

**Author:** ![VinayM30](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinaym30/32/73420_2.png) [@VinayM30](https://discuss.elastic.co/u/VinayM30)\
**Post date:** [August 7, 2020, 6:58am UTC](https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966/5 "2020-08-07T06:58:53Z")

</div>

Actually Sachin I have downloaded a "gz" file and unzipped it so do not have those paths.  
It seems the last\_run\_metadata\_path was the problem

---

<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 4, 2020, 6:59am UTC](https://discuss.elastic.co/t/logstash-7-2-0-input-jdbc-plugin-restarts-itself-and-inserts-data-continuously-in-elastic/243966/6 "2020-09-04T06:59:05Z")

</div>

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