# Logstash Input JDBC Error - 2.0 - Sql Server

**URL:** <https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178>\
**Category:** Logstash\
**Created:** [October 28, 2015, 6:27pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178 "2015-10-28T18:27:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![canoycano](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@canoycano](https://discuss.elastic.co/u/canoycano)\
**Post date:** [October 28, 2015, 6:27pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/1 "2015-10-28T18:27:53Z")

</div>

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}  
}  
~

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 28, 2015, 11:39pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/2 "2015-10-28T23:39:54Z")

</div>

Can you provide the full log/stacktrace?

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

---

<div class="post-metadata">

**Author:** ![canoycano](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@canoycano](https://discuss.elastic.co/u/canoycano)\
**Post date:** [October 29, 2015, 10:08pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/3 "2015-10-29T22:08:23Z")

</div>

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:in`make\_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:in`available'  
/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:in`acquire'  
/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:in`synchronize'  
/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:in`acquire'  
/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:in`synchronize'  
/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:in`prepare\_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:in`start\_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:in`start\_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:in`execute'  
/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:in`call'  
/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:in`call'  
/opt/logstash-2.0.0/vendor/bundle/jruby/1.9/gems/stud-0.0.22/lib/stud/task.rb:24:in `initialize'

---

<div class="post-metadata">

**Author:** ![suyograo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suyograo/32/44898_2.png) [@suyograo](https://discuss.elastic.co/u/suyograo)\
**Post date:** [October 30, 2015, 5:05am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/4 "2015-10-30T05:05:10Z")

</div>

Thanks for reporting this issue. This is a known [issue](https://github.com/logstash-plugins/logstash-input-jdbc/pull/69) 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.

```auto
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

---

<div class="post-metadata">

**Author:** ![Hoffin](https://avatars.discourse-cdn.com/v4/letter/h/9dc877/32.png) [@Hoffin](https://discuss.elastic.co/u/Hoffin)\
**Post date:** [October 30, 2015, 10:00am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/5 "2015-10-30T10:00:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hoffin](https://avatars.discourse-cdn.com/v4/letter/h/9dc877/32.png) [@Hoffin](https://discuss.elastic.co/u/Hoffin)\
**Post date:** [October 30, 2015, 10:01am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/6 "2015-10-30T10:01:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 30, 2015, 10:35am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/7 "2015-10-30T10:35:36Z")

</div>

Please start your own threads.

---

<div class="post-metadata">

**Author:** ![canoycano](https://avatars.discourse-cdn.com/v4/letter/c/cab0a1/32.png) [@canoycano](https://discuss.elastic.co/u/canoycano)\
**Post date:** [October 30, 2015, 5:07pm UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/8 "2015-10-30T17:07:40Z")

</div>

Great, thanks a bunch!

---

<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:** [July 6, 2017, 5:24am UTC](https://discuss.elastic.co/t/logstash-input-jdbc-error-2-0-sql-server/33178/9 "2017-07-06T05:24:49Z")

</div>


