Logstash Input JDBC Error - 2.0 - Sql Server

Hello all I've got a pretty major issue with the logstash 2.0 jdbc input plugin, It seems to not connect to my jdbc input for sqljdbc4.jar, when I run logstash I get the following error message "The error reported is:
TypeError: cannot convert instance of class org.jruby.RubyObject to class java.lang.String"
This is across any SQLServer instance I try to connect to. I have used this frequently in previous versions of logstash, and was hoping to upgrade to the latest version of logstash in production but cannot until this is fixed.My hunch is that there is some incompatibility between the jdbc driver and the input plugin, so as soon as input plugin reads the .jar file the program fails. Here is an example conf file {
jdbc {
# SQL Server jdbc connection string to our database, mydb
jdbc_connection_string => "jdbc:sqlserver://ESP:1433;database=Prod"
# The user we wish to execute our statement as
jdbc_user => "ESP"
# The password we wish to execute our statement as
jdbc_password => "xxxxxxx"
# The path to our downloaded jdbc driver
jdbc_driver_library => "/home/joshuac/sqljdbc_4.2/enu/sqljdbc4.jar"
# The name of the driver class for Postgresql
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
# our query
statement => "select id, ord_no from es.ESE_ord_ordload"
type => "header"
}
}

output {
stdout {codec => json}
}
~

Can you provide the full log/stacktrace?

Please also format it as code so it's easier to read :slight_smile:

Sure thing! Below is the verbose error

Reading config file {:file=>"logstash/agent.rb", :level=>:debug, :line=>"318", :method=>"local_config"}
Compiled pipeline code:
@inputs = []
@filters = []
@outputs = []
@periodic_flushers = []
@shutdown_flushers = []
@input_jdbc_1 = plugin("input", "jdbc", LogStash::Util.hash_merge_many({ "jdbc_connection_string" => ("jdbc:sqlserver://ESP:1433;database=Prod") }, { "jdbc_user" => ("ESP") }, { "jdbc_password" => ("xxxxx") }, { "jdbc_driver_library" => ("/home/joshuac/sqljdbc_4.2/enu/sqljdbc42.jar") }, { "jdbc_driver_class" => ("com.microsoft.sqlserver.jdbc.SQLServerDriver") }, { "statement" => ("SELECT * FROM es.ese_cs_cancels WHERE ord_received_dt_raw > GETDATE() - 35") }, { "type" => ("cancels") }))
Plugin not defined in namespace, checking for plugin file {:type=>"input", :name=>"jdbc", :path=>"logstash/inputs/jdbc", :level=>:debug, :file=>"logstash/plugin.rb", :line=>"71", :method=>"lookup"}
config LogStash::Inputs::Jdbc/@jdbc_connection_string = "jdbc:sqlserver://ESP:1433;database=Prod" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Jdbc/@jdbc_user = "ESP_SA" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Jdbc/@jdbc_password = {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Jdbc/@jdbc_driver_library = "/home/joshuac/sqljdbc_4.2/enu/sqljdbc42.jar" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Jdbc/@jdbc_driver_class = "com.microsoft.sqlserver.jdbc.SQLServerDriver" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Jdbc/@statement = "SELECT * FROM es.ese_cs_cancels WHERE ord_received_dt_raw > GETDATE() - 35" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}
config LogStash::Inputs::Jdbc/@type = "cancels" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"128", :method=>"config_init"}

Default settings used: Filter workers: 4
The error reported is:
TypeError: cannot convert instance of class org.jruby.RubyObject to class java.lang.String
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/adapters/jdbc.rb:216:in connect' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool.rb:101:inmake_new'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:222:in make_new' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:195:inavailable'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:131:in _acquire' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:145:inacquire'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:263:in sync' org/jruby/ext/thread/Mutex.java:149:insynchronize'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:263:in sync' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:144:inacquire'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/connection_pool/threaded.rb:102:in hold' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/database/connecting.rb:254:insynchronize'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/sequel-4.27.0/lib/sequel/database/connecting.rb:264:in test_connection' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-2.0.3/lib/logstash/plugin_mixins/jdbc.rb:118:inprepare_jdbc_connection'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-2.0.3/lib/logstash/inputs/jdbc.rb:144:in register' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.0.0-java/lib/logstash/pipeline.rb:145:instart_inputs'
org/jruby/RubyArray.java:1613:in each' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.0.0-java/lib/logstash/pipeline.rb:144:instart_inputs'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.0.0-java/lib/logstash/pipeline.rb:80:in run' /opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.0.0-java/lib/logstash/agent.rb:157:inexecute'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.0.0-java/lib/logstash/runner.rb:90:in run' org/jruby/RubyProc.java:271:incall'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/logstash-core-2.0.0-java/lib/logstash/runner.rb:95:in run' org/jruby/RubyProc.java:271:incall'
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/stud-0.0.22/lib/stud/task.rb:24:in `initialize'

Thanks for reporting this issue. This is a known issue we had fixed recently, but had forgotten to publish the plugin. I just published v2.0.4 of jdbc input plugin. You can install this version on 2.0 and this error should go away.

bin/plugin install --version 2.0.4 logstash-input-jdbc

Users freshly installing jdbc-input plugin will not be hitting this issue because they'll get the most recent version 2.0.4

Logstash jdbc-input plugin all fields mapped to String data type, and not identifying correct type.

For Logstash is there any input plugin is for constructing entity from mysql bin logs.

Please start your own threads.

Great, thanks a bunch!