JDBC SQL Server connection issue

Hello everyone,

Since yesterday, I can't anymore connect to my sql server.
I got a problem on method close connection.

  • Logstash 5.4.3
  • SQL Server JDBC Driver

Conf

input {
  jdbc {
    jdbc_driver_library => "C:\soft\logstash-5.4.3\lib\jdbc-MSsql-6.2.1.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    jdbc_default_timezone => "UTC"
    jdbc_user => "login"
    jdbc_connection_string => "jdbc:sqlserver://server;instance=xxx;databaseName=xxx;"	
    jdbc_password => "password"
    schedule => "* * * * *"
    statement => "SELECT TOP 10000 * 
				FROM PWODecisionHistory
				WHERE XDateInserted > '08/01/2017'
				ORDER BY XDateInserted"
    tracking_column => "XDateInserted"
    use_column_value => "true"
    last_run_metadata_path => "C:\soft\logstash-5.4.3\inputs\.decisionhistory"
	type => "decisionHistory"
  }
}
filter {
	if [type] == "decisionHistory" {
		mutate {
			gsub => [
				"reasonhead", "\"", "'"
				]
		}
	}
}
output {
	if [type] == "decisionHistory" {
		elasticsearch {
			hosts => ["SERVER:PORT"]
			index => "dechistory-%{+YYYY.MM}"
		}
	}
}

Logs

{ 292868 rufus-scheduler intercepted an error:
292868 job:
292868 Rufus::Scheduler::CronJob "* * * * *" {}
292868 error:
292868 292868
292868 NoMethodError
292868 undefined method close_jdbc_connection' for #<Sequel::JDBC::Database:0x1faa18b6> 292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.2.0/lib/logstash/plugin_mixins/ jdbc.rb:174:in open_jdbc_connection'
292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.2.0/lib/logstash/plugin_mixins/
jdbc.rb:217:in execute_statement' 292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.2.0/lib/logstash/inputs/jdbc.rb :272:in execute_query'
292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/logstash-input-jdbc-4.2.0/lib/logstash/inputs/jdbc.rb
:250:in run' 292868 org/jruby/RubyProc.java:281:in call'
292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:234
:in do_call' 292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:258 :in do_trigger'
292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:300
:in start_work_thread' 292868 org/jruby/RubyProc.java:281:in call'
292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:299
:in start_work_thread' 292868 org/jruby/RubyKernel.java:1479:in loop'
292868 C:/soft/logstash-5.4.3/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:289
:in `start_work_thread'
292868 tz:
292868 ENV['TZ']:
292868 Time.now: 2017-08-04 11:03:29 +0200
292868 scheduler:
292868 object_id: 197208
292868 opts:
292868 {:max_work_threads=>1}
292868 frequency: 0.3
292868 scheduler_lock: #Rufus::Scheduler::NullLock:0x2865f5ac
292868 trigger_lock: #Rufus::Scheduler::NullLock:0x15924126
292868 uptime: 72.621 (1m12s620)
292868 down?: false
292868 threads: 2
292868 thread: #Thread:0x21f5f8df
292868 thread_key: rufus_scheduler_197208
292868 work_threads: 1
292868 active: 1
292868 vacant: 0
292868 max_work_threads: 1
292868 mutexes: {}
292868 jobs: 1
292868 at_jobs: 0
292868 in_jobs: 0
292868 every_jobs: 0
292868 interval_jobs: 0
292868 cron_jobs: 1
292868 running_jobs: 1
292868 work_queue: 0
} 292868 .

Judging by Logstash sqlserver issue NoMethod Error, undefined method close_jdbc_connection this could be the result of a bad username or password.

Really sorry, I forgot the port in my jdbc...
That's resolved my problem.
Maybe it can be usefull in next version to have an explicit message about connection failed instead a stack trace like that which is not usefull for find the problem.

Thank you anyway for your quick reply :slight_smile:.

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