JDBC connection to DB2 failed

I want to check one of our DB2 database's table via logstash but I got this exception.

[2018-02-06T13:34:34,175][ERROR][logstash.agent ] Pipeline aborted due to error {:exception=>#<Sequel::DatabaseConnectionError: Java::JavaSql::SQLException: The application requester cannot establish the connection. (Connection refused)>, :backtrace=>["com.ibm.as400.access.JDError.createSQLExceptionSubClass(com/ibm/as400/access/JDError.java:824)", "com.ibm.as400.access.JDError.throwSQLException(com/ibm/as400/access/JDError.java:553)", "com.ibm.as400.access.AS400JDBCConnection.setProperties(com/ibm/as400/access/AS400JDBCConnection.java:3391)", "com.ibm.as400.access.AS400JDBCDriver.prepareConnection(com/ibm/as400/access/AS400JDBCDriver.java:1419)", "com.ibm.as400.access.AS400JDBCDriver.initializeConnection(com/ibm/as400/access/AS400JDBCDriver.java:1256)", "com.ibm.as400.access.AS400JDBCDriver.connect(com/ibm/as400/access/AS400JDBCDriver.java:395)", "java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)",

this is my input config

 input {
     beats {
        port => 5044
        ssl => true
        ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
        ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
     }
     jdbc {
        jdbc_connection_string => "jdbc:as400://ip/db"
        jdbc_user => "usr"
        jdbc_password => "pass"
        jdbc_driver_library => "/etc/logstash/lib/jt400-9.1.jar"
        jdbc_driver_class => "com.ibm.as400.access.AS400JDBCDriver"
        statement => "SELECT * FROM table1 FETCH FIRST ROWS ONLY"
     }
 }

I have to mention that the firewall inside of the Database have been disabled.

Did you tried with: jdbc_connection_string => "jdbc:as400://[ip];database name=[db]"

thank you for reply.
but no thing changed

["com.ibm.as400.access.JDError.createSQLExceptionSubClass(com/ibm/as400/access/JDError.java:824)", "com.ibm.as400.access.JDError.throwSQLException(com/ibm/as400/access/JDError.java:553)", "com.ibm.as400.access.AS400JDBCConnection.setProperties(com/ibm/as400/access/AS400JDBCConnection.java:3391)", "com.ibm.as400.access.AS400JDBCDriver.prepareConnection(com/ibm/as400/access/AS400JDBCDriver.java:1419)", "com.ibm.as400.access.AS400JDBCDriver.initializeConnection(com/ibm/as400/access/AS400JDBCDriver.java:1256)",

I think it is because of incompatibility of logstash and DB2. I use logstash version 5.1.1 and jt400-9.1 but I don't know which versions work perfect

If you turn on debug logging, I think you should see a message that shows the actual connection string used to establish a connection.

Post it here.

I use db2jcc4.jar instead of jt400.jar and my problem solevd

2 Likes

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