# SQLRecoverableException: ORA-17008: Closed connection

**URL:** <https://discuss.elastic.co/t/sqlrecoverableexception-ora-17008-closed-connection/377428>\
**Category:** Logstash\
**Tags:** jdbc\
**Created:** [April 23, 2025, 10:01am UTC](https://discuss.elastic.co/t/sqlrecoverableexception-ora-17008-closed-connection/377428 "2025-04-23T10:01:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Witcherek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/witcherek/32/142790_2.png) [@Witcherek](https://discuss.elastic.co/u/Witcherek)\
**Post date:** [April 23, 2025, 10:01am UTC](https://discuss.elastic.co/t/sqlrecoverableexception-ora-17008-closed-connection/377428/1 "2025-04-23T10:01:58Z")

</div>

Hello,

Since two weeks we have problem that from time to time our logstash pipeline which is connecting to oracle databse with jdbc\_streaming filter is throwing, exception=\>#\<Sequel::DatabaseDisconnectError: Java::JavaSql::SQLRecoverableException: ORA-17008: Closed connection

```auto
 jdbc_streaming {
      jdbc_driver_library => "/usr/share/logstash/config/bin/ojdbc11.jar"
      jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
      jdbc_user => "${ls_prod_user}"
      jdbc_password => "${ls_prod_pass}"
      jdbc_connection_string => "jdbc:oracle:thin:@//prodhost.back.dom:1533/prod.dom" 
      jdbc_validate_connection => true
      jdbc_validation_timeout => 300
      sequel_opts => {
        max_connections => 4
        pool_timeout => 180
      }
      parameters => {
        "store" => "%{store}"
        "seq" => "%{_seq}"
        "converteddate" => "%{converted_date}"
        "wkst" => "%{wkst}"
      }
      statement => "our query"
      target => "data"
    }

```

On network level connection is possible netcat and telnet are working fine. Our workaround is to restart container where logstash is running, after restart the connection is possible and logstash is processing data without problem.

Did somebody have similar problem and found some solution to automatically refresh/reestablish connection to db?

---

<div class="post-metadata">

**Author:** ![Alex\_Salgado-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_salgado-elastic/32/103081_2.png) [@Alex\_Salgado-Elastic](https://discuss.elastic.co/u/Alex_Salgado-Elastic)\
**Post date:** [April 23, 2025, 11:43am UTC](https://discuss.elastic.co/t/sqlrecoverableexception-ora-17008-closed-connection/377428/2 "2025-04-23T11:43:44Z")

</div>

Hi @Witcherek , welcome to our community.

Have you checked if the Oracle database is logging anything about these closed connections in the alert logs?

Thanks

---

<div class="post-metadata">

**Author:** ![Witcherek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/witcherek/32/142790_2.png) [@Witcherek](https://discuss.elastic.co/u/Witcherek)\
**Post date:** [April 29, 2025, 9:58am UTC](https://discuss.elastic.co/t/sqlrecoverableexception-ora-17008-closed-connection/377428/3 "2025-04-29T09:58:20Z")

</div>

Hello @Alex_Salgado-Elastic

From DB guys it seems that they are restarting database on weekends, in logstash logs the time is very similar to our problem with connection.

---

<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:** [April 29, 2025, 2:35pm UTC](https://discuss.elastic.co/t/sqlrecoverableexception-ora-17008-closed-connection/377428/4 "2025-04-29T14:35:08Z")

</div>

The filter expects the sequel library to manage the connection pool. There was a [PR](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/153) earlier this year to bump the library dependency to make sure this particular exception is handled by it.

/usr/share/logstash/vendor/bundle/jruby/3.1.0/gems/logstash-integration-jdbc-5.5.3/logstash-integration-jdbc.gemspec should include `s.add_runtime_dependency 'sequel', '>= 5.74.0'`. If not, you may be able to fix this by upgrading logstash.
