1

I am trying to get my sqlserver table into Elasticsearch using Logstash. For that i have created below configuration file.

input {
  jdbc { 
    jdbc_connection_string => "jdbc:sqlserver://xxx.xxx.x.xxx:1433/DB_name"
    jdbc_user => "devuser"
    jdbc_password => "devuser"
    jdbc_driver_library => "D:/Mssqljdbc/sqljdbc4-2.0.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    statement => "SELECT * FROM sample"
    }
  }
output {
  stdout { codec => json_lines }
  elasticsearch {
  hosts => "localhost"
  index => "testmigrate"
  document_type => "data"
  }
}

then i am using bin\logstash -f sqltable.conf to execute it. But i am getting

Error: Java::ComMicrosoftSqlserverJdbc::SQLServerException: The port number 1433/DB_name is not valid.

i checked i am able to ping the particular ip address and the port is also openbut still i am getting the same error. Please help

1 Answer 1

1

After a bit of digging i did a small change and it worked for me. I added databaseName in front of the DB_name.

input {
  jdbc { 
    jdbc_connection_string => "jdbc:sqlserver://xxx.xxx.x.xxx:1433;databaseName=DB_name"
    jdbc_user => "devuser"
    jdbc_password => "devuser"
    jdbc_driver_library => "D:/Mssqljdbc/sqljdbc4-2.0.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    statement => "SELECT * FROM sample"
    }
  }
output {
  stdout { codec => json_lines }
  elasticsearch {
  hosts => "localhost"
  index => "testmigrate"
  document_type => "data"
  }
}

It is quite strange i didn't found this in any of the documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.