# JDBC Input plugin, Communication link failure in Logstash version 6.5.4 (latest)

**URL:** <https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983>\
**Category:** Logstash\
**Created:** [January 21, 2019, 6:31am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983 "2019-01-21T06:31:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Wahi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_wahi/32/66559_2.png) [@Abhishek\_Wahi](https://discuss.elastic.co/u/Abhishek_Wahi)\
**Post date:** [January 21, 2019, 6:31am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/1 "2019-01-21T06:31:55Z")

</div>

Hi,

I am facing this issue with JDBC input plugin.

Sometime my logstash script throw this error :

[2019-01-21T00:59:25,984][ERROR][logstash.inputs.jdbc] Unable to connect to database. Tried 1 times {:error\_message=\>"Java::ComMysqlCjJdbcExceptions::CommunicationsException: Communications link failure\n\nThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server."}  
[2019-01-21T00:59:26,016][ERROR][logstash.pipeline] A plugin had an unrecoverable error. Will restart this plugin.  
Pipeline\_id:main  
Plugin: \<LogStash::Inputs::Jdbc jdbc\_user=\>"bigdata\_usr", jdbc\_password=\>, statement=\>"select bigdata\_id,brand\_id,brand as brand\_name,cur\_level as level,CONCAT(DATE(now()),'T',TIME(now()),'Z')`timestamp` from fwall\_level\_bigdata\nWHERE pub\_date \>= DATE\_ADD(CURRENT\_DATE, INTERVAL - 1 MONTH) AND brand IS NOT NULL AND brand !='' and bigdata\_id is not null;", jdbc\_driver\_library=\>"/opt/db-recommendation/lib/mysql-connector-java-6.0.6.jar", jdbc\_connection\_string=\>"jdbc:mysql://192.168.0.1:3306/Databasename", id=\>"e2eae9c25bca0d594a94b9d9f8c54f9e26ec64ab1e0d728f65263e930bcde45c", jdbc\_driver\_class=\>"com.mysql.cj.jdbc.Driver", enable\_metric=\>true, codec=\>\<LogStash::Codecs::Plain id=\>"plain\_28d41ba3-ab3e-4de0-8ce6-7e2f585c3720", enable\_metric=\>true, charset=\>"UTF-8"\>, jdbc\_paging\_enabled=\>false, jdbc\_page\_size=\>100000, jdbc\_validate\_connection=\>false, jdbc\_validation\_timeout=\>3600, jdbc\_pool\_timeout=\>5, sql\_log\_level=\>"info", connection\_retry\_attempts=\>1, connection\_retry\_attempts\_wait\_time=\>0.5, parameters=\>{"sql\_last\_value"=\>2019-01-21 00:52:27 +0530}, last\_run\_metadata\_path=\>"/home/centos/.logstash\_jdbc\_last\_run", use\_column\_value=\>false, tracking\_column\_type=\>"numeric", clean\_run=\>false, record\_last\_run=\>true, lowercase\_column\_names=\>true\>  
Error: Java::ComMysqlCjJdbcExceptions::CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.  
Exception: Sequel::DatabaseConnectionError  
Stack: com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(com/mysql/cj/jdbc/exceptions/SQLError.java:590)  
com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(com/mysql/cj/jdbc/exceptions/SQLExceptionsMapping.java:57)  
com.mysql.cj.jdbc.ConnectionImpl.createNewIO(com/mysql/cj/jdbc/ConnectionImpl.java:1606)  
com.mysql.cj.jdbc.ConnectionImpl.(com/mysql/cj/jdbc/ConnectionImpl.java:633)  
com.mysql.cj.jdbc.ConnectionImpl.getInstance(com/mysql/cj/jdbc/ConnectionImpl.java:347)  
com.mysql.cj.jdbc.NonRegisteringDriver.connect(com/mysql/cj/jdbc/NonRegisteringDriver.java:219)  
java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)

And pipeline go in indefinite state. I am using the latest version still this issue is coming.

**How can i fix this error ??**

**And if i want to apply retry on this error. How can I do that ??**

Please help.

---

<div class="post-metadata">

**Author:** ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)\
**Post date:** [January 21, 2019, 10:15am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/2 "2019-01-21T10:15:12Z")

</div>

probably your database is getting down. Please check your database connection when this error occurs.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Wahi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_wahi/32/66559_2.png) [@Abhishek\_Wahi](https://discuss.elastic.co/u/Abhishek_Wahi)\
**Post date:** [January 21, 2019, 10:32am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/3 "2019-01-21T10:32:45Z")

</div>

I have checked this, no issues on database side.

---

<div class="post-metadata">

**Author:** ![balumurari1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/balumurari1/32/39203_2.png) [@balumurari1](https://discuss.elastic.co/u/balumurari1)\
**Post date:** [January 21, 2019, 10:33am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/4 "2019-01-21T10:33:41Z")

</div>

ok then can you provide your input code to validate

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [January 21, 2019, 10:47am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/5 "2019-01-21T10:47:28Z")

</div>

Try setting [connection\_retry\_attempts](https://www.elastic.co/guide/en/logstash-versioned-plugins/current/v4.3.13-plugins-inputs-jdbc.html#v4.3.13-plugins-inputs-jdbc-connection_retry_attempts) to 5  
Look at increasing the [connection\_retry\_attempts\_wait\_time](https://www.elastic.co/guide/en/logstash-versioned-plugins/current/v4.3.13-plugins-inputs-jdbc.html#v4.3.13-plugins-inputs-jdbc-connection_retry_attempts_wait_time) to 2 (seconds)

---

<div class="post-metadata">

**Author:** ![Abhishek\_Wahi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_wahi/32/66559_2.png) [@Abhishek\_Wahi](https://discuss.elastic.co/u/Abhishek_Wahi)\
**Post date:** [January 22, 2019, 5:58am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/6 "2019-01-22T05:58:19Z")

</div>

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:mysql://IP:PORT/DATABASE"  
jdbc\_user =\> "username"  
jdbc\_password =\> "password"  
jdbc\_driver\_library =\> "/opt/db-recommendation/lib/mysql-connector-java-6.0.6.jar"  
jdbc\_driver\_class =\> "com.mysql.cj.jdbc.Driver"  
jdbc\_validate\_connection =\> true  
jdbc\_validation\_timeout =\> 120  
jdbc\_pool\_timeout =\> 60  
jdbc\_paging\_enabled =\> true  
jdbc\_page\_size =\> 50000  
statement =\> "select bigdata\_id,brand\_id,brand as brand\_name,cur\_level as level,CONCAT(DATE(now()),'T',TIME(now()),'Z')`timestamp` from fwall\_level\_bigdata  
WHERE pub\_date \>= DATE\_ADD(CURRENT\_DATE, INTERVAL - 1 MONTH) AND brand IS NOT NULL AND brand !='' and bigdata\_id is not null"  
}  
}

This is my updated input code in conf file.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Wahi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_wahi/32/66559_2.png) [@Abhishek\_Wahi](https://discuss.elastic.co/u/Abhishek_Wahi)\
**Post date:** [January 22, 2019, 5:58am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/7 "2019-01-22T05:58:46Z")

</div>

Thanks.

I will try this.

---

<div class="post-metadata">

**Author:** ![Abhishek\_Wahi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhishek_wahi/32/66559_2.png) [@Abhishek\_Wahi](https://discuss.elastic.co/u/Abhishek_Wahi)\
**Post date:** [January 23, 2019, 10:28am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/8 "2019-01-23T10:28:13Z")

</div>

Hi,

Thanks for replying,

But these settings are also not working. After printing Communication link failure in logs the pipeline terminates and not retrying.

---

<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:** [February 20, 2019, 10:28am UTC](https://discuss.elastic.co/t/jdbc-input-plugin-communication-link-failure-in-logstash-version-6-5-4-latest/164983/9 "2019-02-20T10:28:16Z")

</div>

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