# Logstash pipeline MS SQL Server Query

**URL:** https://discuss.elastic.co/t/logstash-pipeline-ms-sql-server-query/217798
**Category:** Logstash
**Created:** [February 4, 2020, 12:21pm UTC](https://discuss.elastic.co/t/logstash-pipeline-ms-sql-server-query/217798 "2020-02-04T12:21:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ginu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginu/32/86297_2.png) [@ginu](https://discuss.elastic.co/u/ginu)
#### Post date: [February 4, 2020, 12:21pm UTC](https://discuss.elastic.co/t/logstash-pipeline-ms-sql-server-query/217798/1 "2020-02-04T12:21:51Z")

</div>

Hi all  
I am trying to do SQL Query to SQL Server using JDBC and trying to get some data from SQL Server database.

my logstash pipeline looks:

```
input {
jdbc {
    jdbc_validate_connection => true
    jdbc_driver_library => "/opt/sqljdbc41.jar"
    jdbc_driver_class => "jdbc:com.microsoft.jdbc.sqlserver.SQLServerDriver"
    jdbc_connection_string => "microsoft:sqlserver://10.91.18.56:1433;DatabaseName=master"
    jdbc_user => "myDomain\myDBUser"
    jdbc_password => "myPwd"
    statement => "select 1"
    schedule => "*/1 * * * *"
    }
}
  filter {
}
output {
        stdout { codec => rubydebug }
}

```

Unfortunately, this is constantly failing with the following error:

```
LogStash::ConfigurationError
Feb 04 13:17:00 syspa-test058 logstash[29964]: 2132 jdbc:com.microsoft.jdbc.sqlserver.SQLServerDriver not loaded. Are you sure you've included the correct jdbc driver in :jdbc_driver_library?
Feb 04 13:17:00 syspa-test058 logstash[29964]: 2132 /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:163:in `open_jdbc_connection'
Feb 04 13:17:00 syspa-test058 logstash[29964]: 2132 /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:221:in `execute_statement'

```

I have already tried with the different version of SQL Server JDBC driver which was not helping a lot; [https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15](https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver15)

I am having SQL server version 2019.  
Any idea what am I doing wrong?  
Regards,  
Ginu

---

<div class="post-metadata">

### Author: ![ginu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginu/32/86297_2.png) [@ginu](https://discuss.elastic.co/u/ginu)
#### Post date: [February 4, 2020, 1:18pm UTC](https://discuss.elastic.co/t/logstash-pipeline-ms-sql-server-query/217798/2 "2020-02-04T13:18:09Z")

</div>

Hi  
Could fix this by using the matching version of jdbc driver /mssql-jdbc-7.4.1.jre8.jar on ES 7.5.1

Regards,  
Ginu

---

<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 3, 2020, 1:18pm UTC](https://discuss.elastic.co/t/logstash-pipeline-ms-sql-server-query/217798/3 "2020-03-03T13:18:12Z")

</div>

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