# JDBC I/P Plugin -Connecting to DB2

**URL:** <https://discuss.elastic.co/t/jdbc-i-p-plugin-connecting-to-db2/145433>\
**Category:** Logstash\
**Created:** [August 21, 2018, 4:49pm UTC](https://discuss.elastic.co/t/jdbc-i-p-plugin-connecting-to-db2/145433 "2018-08-21T16:49:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![parvipul](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@parvipul](https://discuss.elastic.co/u/parvipul)\
**Post date:** [August 21, 2018, 4:49pm UTC](https://discuss.elastic.co/t/jdbc-i-p-plugin-connecting-to-db2/145433/1 "2018-08-21T16:49:32Z")

</div>

I trying to connect to DB2 database on Mainframe from my local m/c. I am using JDBC input plugin. It seems the jdbc driver license file is not getting loaded. Can someone please tell me how can I load the db2jcc\_license\_cisuz-1.4.2.jar file.  
I am using logstash version 6.2.2  
I am able to connect to DB2 using the same license file from other Java applications.  
My config file is as follows:

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

Log file :

[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-

---

<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:** [September 18, 2018, 4:56pm UTC](https://discuss.elastic.co/t/jdbc-i-p-plugin-connecting-to-db2/145433/2 "2018-09-18T16:56:04Z")

</div>

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