# Logstash JDBC with Docker not loaded

**URL:** <https://discuss.elastic.co/t/logstash-jdbc-with-docker-not-loaded/142325>\
**Category:** Logstash\
**Created:** [July 31, 2018, 9:33am UTC](https://discuss.elastic.co/t/logstash-jdbc-with-docker-not-loaded/142325 "2018-07-31T09:33:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ragnar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ragnar/32/7610_2.png) [@Ragnar](https://discuss.elastic.co/u/Ragnar)\
**Post date:** [July 31, 2018, 9:33am UTC](https://discuss.elastic.co/t/logstash-jdbc-with-docker-not-loaded/142325/1 "2018-07-31T09:33:18Z")

</div>

Build an Elastic stack where I have to connect to a MSSQL Database. So I build my own Logstash image where I import the JDBC driver to the container.

```
FROM docker.elastic.co/logstash/logstash:6.3.0
USER root
COPY mssql-jdbc-6.4.0.jre9.jar /opt/
# Add your logstash plugins setup here
RUN logstash-plugin install logstash-input-jdbc
# Example: RUN logstash-plugin install logstash-filter-json

```

Then I launch my docker-compose file.

```
# Elastic and Kibana config remove for clarity

logstash:
# image: docker.elastic.co/logstash/logstash:${TAG}
    build: logstash/
    container_name: Logstash
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    env_file:
      - .env
    ports:
      - '5001:5001'
    volumes:
      - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml
      - ./logstash/pipeline:/usr/share/logstash/pipeline
    depends_on:
      - elasticsearch1
    networks:
      - esnet

```

Here my logstash.conf

```
input {
    jdbc {
           jdbc_driver_library => "/opt/mssql-jdbc-6.4.0.jre9.jar"
           jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
           jdbc_connection_string => "jdbc:sqlserver:// ****.database.windows.net"
           jdbc_user => "${DB_USERNAME}"
           jdbc_password => "${DB_PASSWORD}"
           statement => "select * from *****.dbo.association"
        }
}

output {
    elasticsearch {
        hosts => ["http://elasticsearch1:9200", "http://elasticsearch2:9200"] 
    }
    stdout {
        codec => rubydebug
    }
}

```

Then I got this error. `Error: com.microsoft.sqlserver.jdbc.SQLServerDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?`

---

<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 28, 2018, 9:33am UTC](https://discuss.elastic.co/t/logstash-jdbc-with-docker-not-loaded/142325/2 "2018-08-28T09:33:18Z")

</div>

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