Jdbc MSSql Server Connection

I have an MSSQL jdbc connection working using the following syntax:

input {
  jdbc {
     jdbc_driver_library => "/etc/logstash/driver/sqljdbc_4.0/enu/sqljdbc4.jar"
     jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
     jdbc_connection_string => "jdbc:sqlserver://MYSERVER:MYPORT;databasename=MYDATABASENAME"
     jdbc_user => "MYUSER"
     jdbc_password => "MYPASSWORD"
     statement => "SELECT @@Version"
  }
}

If this does not work then I would check the SQL Server for the following:

  • Is the port correct in the jdbc connection? MSSQL can use dynamic ports, so you need to confirm this is correct for the target instance.

  • Check the SQL Log for failed login attempts from the login.

  • Check the SQL Login has has access to the database.

2 Likes