# JDBC connection remain open after data insertion in Elastic search

**URL:** <https://discuss.elastic.co/t/jdbc-connection-remain-open-after-data-insertion-in-elastic-search/67092>\
**Category:** Logstash\
**Created:** [November 24, 2016, 10:44am UTC](https://discuss.elastic.co/t/jdbc-connection-remain-open-after-data-insertion-in-elastic-search/67092 "2016-11-24T10:44:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![toxicashu](https://avatars.discourse-cdn.com/v4/letter/t/ee7513/32.png) [@toxicashu](https://discuss.elastic.co/u/toxicashu)\
**Post date:** [November 24, 2016, 10:44am UTC](https://discuss.elastic.co/t/jdbc-connection-remain-open-after-data-insertion-in-elastic-search/67092/1 "2016-11-24T10:44:41Z")

</div>

Hello,

We are inserting data in Elastic search from multiple postgresql tables using Logstash. Here is a demo view of one of the config file for doing it:  
input {  
jdbc {  
jdbc\_connection\_string =\> "Connection detail"  
jdbc\_user =\> "xyz"  
jdbc\_password =\> "xyz"  
jdbc\_validate\_connection =\> true  
#jdbc\_driver\_library =\> "libaray path"  
jdbc\_driver\_class =\> "org.postgresql.Driver"  
statement =\> "select \* from schema.sdtm\_ex"  
}  
}  
output {  
#stdout { codec =\> json\_lines }  
elasticsearch {  
index =\> "sdtm\_ex"  
document\_type =\> "ex"  
}  
}

Now, after inserting data in the elasticsearch the connection is still showing open in the DB. Is there anyway to to close the JDBC connection once the insertion is complete. Thanks.

Edit 1: This issue happens only when we schedule add scheduler for this incidence. If we do it for once in a single table it works fine.

---

<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:** [December 22, 2016, 10:44am UTC](https://discuss.elastic.co/t/jdbc-connection-remain-open-after-data-insertion-in-elastic-search/67092/2 "2016-12-22T10:44:58Z")

</div>

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