# Connect to mongodb using logstash Jdbc\_streaming filter plugin

**URL:** <https://discuss.elastic.co/t/connect-to-mongodb-using-logstash-jdbc-streaming-filter-plugin/242082>\
**Category:** Logstash\
**Created:** [July 21, 2020, 6:13pm UTC](https://discuss.elastic.co/t/connect-to-mongodb-using-logstash-jdbc-streaming-filter-plugin/242082 "2020-07-21T18:13:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Rasitha\_Ariyarathna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/_rasitha_ariyarathna/32/45836_2.png) [@\_Rasitha\_Ariyarathna](https://discuss.elastic.co/u/_Rasitha_Ariyarathna)\
**Post date:** [July 21, 2020, 6:13pm UTC](https://discuss.elastic.co/t/connect-to-mongodb-using-logstash-jdbc-streaming-filter-plugin/242082/1 "2020-07-21T18:13:53Z")

</div>

I'm trying to fetch data from mongodb using Jdbc\_streaming filter plugin in logstash in windows. I'm using **mongo-java-driver-3.4.2.jar** to connect to the database but, getting a error like this

`JavaSql::SQLException: No suitable driver found for jdbc:mongo://localhost:27017/EmployeeDB `

No any luck with existing references. I'm using logstash 7.8.0 version. This is my logstash config:

```
jdbc_streaming {
        jdbc_driver_library => "C:/Users/iTelaSoft-User/Downloads/logstash-7.8.0/mongo-java-driver-3.4.2.jar"
        jdbc_driver_class => "com.mongodb.MongoClient"
        jdbc_connection_string => "jdbc:mongo://localhost:27017/EmployeeDB"
        statement => "select * from Employee"
        target => "name"
    }

```

How can I fix the above error?

---

<div class="post-metadata">

**Author:** ![chandu5565](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@chandu5565](https://discuss.elastic.co/u/chandu5565)\
**Post date:** [July 31, 2020, 11:54am UTC](https://discuss.elastic.co/t/connect-to-mongodb-using-logstash-jdbc-streaming-filter-plugin/242082/2 "2020-07-31T11:54:26Z")

</div>

Hi Rasitha,

Make sure that you are using right mongo driver. I have faced the same challenge in 7.7.0 with the mongo-java-driver-3.6.4.jar. But I resolved it by upgrading the JDBC driver. You can download jars from below link.

[https://dbschema.com/jdbc-driver/MongoDb.html](https://dbschema.com/jdbc-driver/MongoDb.html)

---

<div class="post-metadata">

**Author:** ![\_Rasitha\_Ariyarathna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/_rasitha_ariyarathna/32/45836_2.png) [@\_Rasitha\_Ariyarathna](https://discuss.elastic.co/u/_Rasitha_Ariyarathna)\
**Post date:** [August 1, 2020, 1:47pm UTC](https://discuss.elastic.co/t/connect-to-mongodb-using-logstash-jdbc-streaming-filter-plugin/242082/3 "2020-08-01T13:47:03Z")

</div>

Hi Chandu,

Thanks for the reply. I did resolve the problem by doing below steps.

1. download [https://dbschema.com/jdbc-drivers/MongoDbJdbcDriver.zip](https://dbschema.com/jdbc-drivers/MongoDbJdbcDriver.zip)
2. unzip and copy all the files to the path(~/logstash-7.8.0/logstash-core/lib/jars/)
3. modify the .config file

Config file:

```
jdbc_streaming
{
     jdbc_driver_library => "absolute_path_to_file\mongojdbc2.1.jar"
     jdbc_driver_class => "com.dbschema.MongoJdbcDriver"
     jdbc_connection_string => "jdbc:mongodb://localhost:27017/nmis"
     statement => " db.events.find({ }, {'_id': false})"
     target => "test_details"
}

```

In the linux environment I had to remove 'jdbc\_driver\_library =\>' property completely from the config and also keep one version of JDBC driver files to get it work.

---

<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:** [August 29, 2020, 1:47pm UTC](https://discuss.elastic.co/t/connect-to-mongodb-using-logstash-jdbc-streaming-filter-plugin/242082/4 "2020-08-29T13:47:06Z")

</div>

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