我正在尝试从本地计算机连接到Mainframe上的DB2数据库。我正在使用JDBC输入插件。看来jdbc驱动程序许可证文件没有被加载。有人可以告诉我如何加载db2jcc_license_cisuz-1.4.2.jar文件。
我正在使用Logstash版本6.2.2
我能够使用其他Java应用程序中的相同许可证文件连接到DB2。
我的配置文件如下:
input {
beats {
port => 5044
}
jdbc {
jdbc_connection_string => "jdbc:db2://XX.XX.XX.XX:1304/DB91"
jdbc_user => "username"
jdbc_password => "password"
jdbc_driver_library => "C:\logstash-6.2.2\logstash-6.2.2\vendor\jruby\lib\jdbc\db2jcc-1.4.2.jar"
jdbc_driver_class => "com.ibm.db2.jcc.DB2Driver"
statement => "SELECT * from DBTPS29.NPSXTEI"
}
}
output {
stdout {codec => json_lines}
}
日志文件:
[2018-08-21T11:19:24,334][ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 1 times {:error_message=>"Java::ComIbmDb2JccAm::SqlSyntaxErrorException: [jcc][t4][10509][13454][3.61.96] Connection to the data server failed. The IBM Data Server for JDBC and SQLJ license was invalid \r\nor was not activated for the DB2 for z/OS subsystem. If you are connecting directly to \r\nthe data server and using DB2 Connect Unlimited Edition for System z, perform the \r\nactivation step by running the activation program in the license activation kit. \r\nIf you are using any other edition of DB2 Connect, obtain the license file, \r\ndb2jcc_license_cisuz.jar, from the license activation kit, and follow the installation \r\ndirections to include the license file in the class path. ERRORCODE=-4230, SQLSTATE=42968"}
[2018-08-21T11:19:24,338][ERROR][logstash.pipeline ] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:main
Plugin: <LogStash::Inputs::Jdbc jdbc_connection_string=>"jdbc:db2://xx.xx.xx.xx:1304/DB91", jdbc_user=>"username", jdbc_password=>, jdbc_driver_library=>"C:\logstash-6.2.2\logstash-6.2.2\vendor\jruby\lib\jdbc\db2jcc-1.4.2.jar", jdbc_driver_class=>"com.ibm.db2.jcc.DB2Driver", statement=>"SELECT * from DBTPS29.NPSXTEI", id=>"f63556360d1928aaaf73cf6a06df9ec2cc1f8252c016d62da5830f446521927e", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_bad95943-2146-4d84-a312-0be5db02acef", enable_metric=>true, charset=>"UTF-8">, jdbc_paging_enabled=>false, jdbc_page_size=>100000, jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, parameters=>{"sql_last_value"=>1970-01-01 00:00:00 UTC}, last_run_metadata_path=>"C:\Users\vipul.parikh/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true>
Error: Java::ComIbmDb2JccAm::SqlSyntaxErrorException: [jcc][t4][10509][13454][3.61.96] Connection to the data server failed. The IBM Data Server for JDBC and SQLJ license was invalid
or was not activated for the DB2 for z/OS subsystem. If you are connecting directly to
the data server and using DB2 Connect Unlimited Edition for System z, perform the
activation step by running the activation program in the license activation kit.
If you are using any other edition of DB2 Connect, obtain the license file,
db2jcc_license_cisuz.jar, from the license activation kit, and follow the installation
directions to include the license file in the class path. ERRORCODE=-4230, SQLSTATE=42968
Exception: Sequel::DatabaseConnectionError
Stack: com.ibm.db2.jcc.am.ed.a(com/ibm/db2/jcc/am/ed.java:676)
com.ibm.db2.jcc.am.ed.a(com/ibm/db2/jcc/am/ed.java:60)
com.ibm.db2.jcc.am.ed.a(com/ibm/db2/jcc/am/ed.java:120)
com.ibm.db2.jcc.am.jb.Qb(com/ibm/db2/jcc/am/jb.java:4339)
com.ibm.db2.jcc.am.jb.b(com/ibm/db2/jcc/am/jb.java:4248)
com.ibm.db2.jcc.t4.b.b(com/ibm/db2/jcc/t4/b.java:537)
com.ibm.db2.jcc.t4.b.a(com/ibm/db2/jcc/t4/b.java:366)
com.ibm.db2.jcc.t4.b.(com/ibm/db2/jcc/t4/b.java:305)
com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(com/ibm/db2/jcc/DB2SimpleDataSource.java:214)
com.ibm.db2.jcc.DB2Driver.connect(com/ibm/db2/jcc/DB2Driver.java:460)
java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:468)
org.jruby.javasupport.JavaMethod.invokeDirect(org/jruby/javasupport/JavaMethod.java:326)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.adapters.jdbc.connect(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/adapters/jdbc.rb:203)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.connection_pool.make_new(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/connection_pool.rb:126)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.connection_pool.threaded.assign_connection(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/connection_pool/threaded.rb:192)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.connection_pool.threaded.acquire(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/connection_pool/threaded.rb:133)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.connection_pool.threaded.hold(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/connection_pool/threaded.rb:90)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.database.connecting.synchronize(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/database/connecting.rb:269)
`C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.database.connecting.test_connection(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/database/connecting.rb:279)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.database.connecting.connect(C:/logstash-6.2.2/logstash-6.2.2/vendor/bundle/jruby/2.3.0/gems/sequel-5.4.0/lib/sequel/database/connecting.rb:58)
C_3a_.logstash_minus_6_dot_2_dot_2.logstash_minus_6_dot_2_dot_2.vendor.bundle.jruby.$2_dot_3_dot_0.gems.sequel_minus_5_dot_4_dot_0.lib.sequel.core.connect(C:/logstash-`
答案 0 :(得分:0)
许可证文件名应为db2jcc_license_cisuz.jar
,并且应与db2jcc.jar或db2jcc4.jar位于相同的目录位置。如果这两个都已被验证为正确,则请与您的Z / OS DB2 DBA交谈并确保已为...by running the activation program in the license activation kit
执行了激活步骤。您的Z / OS DB2 DBA应该知道这意味着什么以及如何做。