# Logstash and mongodb connection using JDBC is not working

**URL:** <https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119>\
**Category:** Logstash\
**Created:** [February 13, 2020, 5:32am UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119 "2020-02-13T05:32:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SanTiaGo\_KarThiCk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santiago_karthick/32/62188_2.png) [@SanTiaGo\_KarThiCk](https://discuss.elastic.co/u/SanTiaGo_KarThiCk)\
**Post date:** [February 13, 2020, 5:32am UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119/1 "2020-02-13T05:32:24Z")

</div>

![log](https://us1.discourse-cdn.com/elastic/original/3X/c/c/ccb8e87a4620f11d6be4ece36d4979b12f0a2128.png)

This is the configuration file gives output as [unable to connect to database and no suitable driver was found!] and I am using logstash version 7.5.1

---

<div class="post-metadata">

**Author:** ![RobBavey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robbavey/32/20421_2.png) [@RobBavey](https://discuss.elastic.co/u/RobBavey)\
**Post date:** [February 13, 2020, 4:46pm UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119/2 "2020-02-13T16:46:58Z")

</div>

@SanTiaGo_KarThiCk Can you try removing the `jdbc_driver_library` setting from your configuration and copying `mongojdbc1.6.jar` onto a location on the Logstash classpath? (`<LOGSTASH_HOME_DIRECTORY>/logstash-core/lib/jars`)

---

<div class="post-metadata">

**Author:** ![SanTiaGo\_KarThiCk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santiago_karthick/32/62188_2.png) [@SanTiaGo\_KarThiCk](https://discuss.elastic.co/u/SanTiaGo_KarThiCk)\
**Post date:** [February 14, 2020, 7:29am UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119/3 "2020-02-14T07:29:03Z")

</div>

Its Some what better than previoous but it facing the error: [no com/mongodb/MongoClientURI class not found]

---

<div class="post-metadata">

**Author:** ![SanTiaGo\_KarThiCk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santiago_karthick/32/62188_2.png) [@SanTiaGo\_KarThiCk](https://discuss.elastic.co/u/SanTiaGo_KarThiCk)\
**Post date:** [February 14, 2020, 9:18am UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119/4 "2020-02-14T09:18:53Z")

</div>

[2020-02-14T14:48:03,395][ERROR][logstash.inputs.jdbc] Unable to connect to database. Tried 1 times {:error\_message=\>"Java::JavaLang::NoClassDefFoundError: com/mongodb/event/ServerMonitorListener"}

this is error now i am facing

---

<div class="post-metadata">

**Author:** ![RobBavey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robbavey/32/20421_2.png) [@RobBavey](https://discuss.elastic.co/u/RobBavey)\
**Post date:** [February 14, 2020, 1:39pm UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119/5 "2020-02-14T13:39:35Z")

</div>

@SanTiaGo_KarThiCk I'm no MongoDB expert, but I suspect there are still some missing dependencies. I did a search for that class, and it looks like it comes from the MongoDB java driver (as opposed to the MongoDB JDBC driver). You will need to add that, plus any other dependencies that MongoDB requires to the classpath in addition to the JDBC driver you have already added.

---

<div class="post-metadata">

**Author:** ![SanTiaGo\_KarThiCk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/santiago_karthick/32/62188_2.png) [@SanTiaGo\_KarThiCk](https://discuss.elastic.co/u/SanTiaGo_KarThiCk)\
**Post date:** [February 17, 2020, 5:42am UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119/6 "2020-02-17T05:42:01Z")

</div>

Thanks Rob its working with java-driver along with JDBC driver

---

<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 16, 2020, 5:52am UTC](https://discuss.elastic.co/t/logstash-and-mongodb-connection-using-jdbc-is-not-working/219119/7 "2020-03-16T05:52:46Z")

</div>

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