# DB sessions | logstash

**URL:** <https://discuss.elastic.co/t/db-sessions-logstash/296845>\
**Category:** Logstash\
**Created:** [February 10, 2022, 1:37pm UTC](https://discuss.elastic.co/t/db-sessions-logstash/296845 "2022-02-10T13:37:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nasser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nasser/32/99437_2.png) [@Nasser](https://discuss.elastic.co/u/Nasser)\
**Post date:** [February 10, 2022, 1:37pm UTC](https://discuss.elastic.co/t/db-sessions-logstash/296845/1 "2022-02-10T13:37:45Z")

</div>

Hi  
i have 20 sql query, 2 query in each jdbc.conf file  
my question is  
how many sessions will jdbc open with DB to execute the query ?  
will open one session and execute 10 query or one session for each query ?  
my conf file

```auto
input {
  jdbc {
    jdbc_driver_library => "/opt/ojdbc7.jar"
    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
    jdbc_connection_string => "jdbc:oracle:thin:@*:*/*"
    jdbc_user => "*"
              jdbc_password => "*"
    schedule => "* * * * *"
    statement => "select * from my table"

  }

##############################################
input {
jdbc {
    jdbc_driver_library => "/opt/ojdbc7.jar"
    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
    jdbc_connection_string => "jdbc:oracle:thin:@*/*"
    jdbc_user => "*"
              jdbc_password => "*"
    schedule => "* * * * *"
    statement => "select * from my table"

  }
}
}

filter {
      uuid {
        target => "uuid"
        overwrite => true
      }
}

output {stdout { codec => rubydebug }
elasticsearch { hosts => ["http://localhost:9200"]
data_stream => "true"
data_stream_type => "logs"
document_id => "%{uuid}"
user => "*"
password => "*"

 }
}

```

thanks

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [February 10, 2022, 2:44pm UTC](https://discuss.elastic.co/t/db-sessions-logstash/296845/2 "2022-02-10T14:44:34Z")

</div>

The inputs are independent from each other, so if you have 20 jdbc inputs, it will be 20 connections to your database.

---

<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:** [March 10, 2022, 2:44pm UTC](https://discuss.elastic.co/t/db-sessions-logstash/296845/3 "2022-03-10T14:44:56Z")

</div>

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