Logstash Jdbc oracle issue

Here is my input file

  • logstash 6.7
  • ojdbc8

input {
jdbc {
jdbc_driver_library => "/usr/lib/oracle/18.3/client64/lib/ojdbc8.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string => "jdbc.oracle:thin:@local:1521/BOPPROD"
jdbc_user => "USR"
jdbc_password => "USR"
statement => "select * from testdata"
}
}

getting error
[ERROR] 2019-05-01 23:19:22.574 [[main]<jdbc] jdbc - Unable to connect to database. Tried 1 times {:error_message=>"LoadError: no such file to load -- sequel/adapters/jdbc.oracle"}

Please assist... thanks in advance.

did you try username/password - lower case?
also you have to put schedule => "10 10 * * *" (same as crontab entry)
and I think you also need jdbc_validate_connection option.

I have pretty much same thing and it works

input {
    jdbc {
        jdbc_validate_connection => true
        jdbc_connection_string => "jdbc:oracle:thin:@ora03:1521/<db_name>"
        jdbc_user => "logstash"
        jdbc_password => "${LOGSTASH_PASSWORD}"
        jdbc_driver_library => "/usr/lib/oracle/12.2/client64/lib/ojdbc8.jar"
        jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
        statement => "select * from employee"
        clean_run=>true
        schedule => "10 11 * * *"
       }
}

This runs daily at 11:10 am because I have clean_run=>true set.

tested.. but it same error still occur

what version is boppord database. may be jdbc version is not compatable with your database.
try elk's jdbc version.
download it and put it somewhere in your system then test

Oracle Version : Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Here is the error log:
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in require' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/sequel-5.18.0/lib/sequel/database/connecting.rb:88:inload_adapter'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/sequel-5.18.0/lib/sequel/database/connecting.rb:17:in adapter_class' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/sequel-5.18.0/lib/sequel/database/connecting.rb:36:inconnect'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/sequel-5.18.0/lib/sequel/core.rb:121:in connect' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-**4.3.13**/lib/logstash/plugin_mixins/jdbc/jdbc.rb:115:inblock in jdbc_connect'
org/jruby/RubyKernel.java:1411:in loop' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:112:injdbc_connect'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:165:in open_jdbc_connection' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/plugin_mixins/jdbc/jdbc.rb:221:inexecute_statement'
/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:277:in execute_query' /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-jdbc-4.3.13/lib/logstash/inputs/jdbc.rb:263:inrun'
/usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:426:in inputworker' /usr/share/logstash/logstash-core/lib/logstash/pipeline.rb:420:inblock in start_input'
[ERROR] 2019-05-03 00:10:24.164 [[main]<jdbc] jdbc - Unable to connect to database. Tried 1 times {:error_message=>"LoadError: no such file to load -- sequel/adapters/jdbc.oracle"}

installed elk's jdbc version :
jdbc_plugin

I am assuming you are able to connect on database locally using this user?

sqlplus USR/USR@BOPROD

Hello @hannkeat please try ojdbc6.jar driver. I am using it without problem to connect to Oracle 12c.

BR,
Mladen

remotely

i tried connect to 11g and 12c .. using sqlplus.. no issue.

But when execute logstash, same error thrown.

Tried... same error :sleepy::cold_sweat:

Hello @hannkeat, you have a typo in JDBC connection:

Your connection:

jdbc_connection_string => "jdbc.oracle:thin:@local:1521/BOPPROD"

Instead of dot(.) you need to put colon(:):

jdbc_connection_string => "jdbc:oracle:thin:@local:1521/BOPPROD"

ah ... my mistaken.. now it work ... thanks :slight_smile:

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