# Using jdbc in logstash to import Elasticsearch data Connection error

**URL:** <https://discuss.elastic.co/t/using-jdbc-in-logstash-to-import-elasticsearch-data-connection-error/322037>\
**Category:** Logstash\
**Created:** [December 27, 2022, 12:35pm UTC](https://discuss.elastic.co/t/using-jdbc-in-logstash-to-import-elasticsearch-data-connection-error/322037 "2022-12-27T12:35:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sandeep\_Raju](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@Sandeep\_Raju](https://discuss.elastic.co/u/Sandeep_Raju)\
**Post date:** [December 27, 2022, 12:35pm UTC](https://discuss.elastic.co/t/using-jdbc-in-logstash-to-import-elasticsearch-data-connection-error/322037/1 "2022-12-27T12:35:27Z")

</div>

Hi all,

I'm trying to import data from different databases from different clusters to my elasticsearch database.

Before importing mysql data to my elasticsearch database , I'm trying to import elasticsearch database from another cluster to my local database elasticsearch.

Below configuration file of my jdbc.conf that I'm running using logstash:

```auto
input {  
jdbc {

jdbc_connection_string => "jdbc:elasticsearch://login:pwd@ccc.ddd.com:9200;database=eee_*;encrypt=false"

# The user you want to execute your statement as
jdbc_user => "elasticsearch"
# The path to your downloaded jdbc driver
jdbc_driver_library => "/etc/logstash-8.4.0/logstash-core/lib/jars/x-pack-sql-jdbc-8.4.0"
# The name of the driver class
jdbc_driver_class => "org.elasticsearch.jdbc.Driver"
# Query for testing purpose
statement => "SELECT * from eee_*"
}
}
output {  
elasticsearch {
 hosts => ["xxx.xx.xx.xx:9200"]
 index => "test_jdbc"
 }
stdout { codec => rubydebug }
   }

```

After setting up this jdbc.conf file, I run below logstash command:  
`sudo bin/logstash -f config/jdbc.conf `

It runs in terminal but it gives below error:

`Outputs::Elasticsearch::HttpClient::Pool::HostUnreachableError, :message=>”Elasticsear ch Unreachable: `

I've checked logs, it shows same error.  
I'm not able to get the error in my conf file.

---

<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:** [December 27, 2022, 12:37pm UTC](https://discuss.elastic.co/t/using-jdbc-in-logstash-to-import-elasticsearch-data-connection-error/322037/2 "2022-12-27T12:37:27Z")

</div>

> [@Sandeep\_Raju](#):
>
> Outputs::Elasticsearch::HttpClient::Pool::HostUnreachableError, :message=\>”Elasticsear ch Unreachable:

This means that your logstash can not connect to the Elasticsearch configured in the output block.

You need to check if the Elasticsearch is running and if the Logstash machina can access it.

---

<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:** [January 24, 2023, 12:37pm UTC](https://discuss.elastic.co/t/using-jdbc-in-logstash-to-import-elasticsearch-data-connection-error/322037/3 "2023-01-24T12:37:45Z")

</div>

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