Knime 3.7 database connector does not connect to DB2

I tried both the drivers db2jcc.jar and db2jcc4.jar from v10.5fp8_jdbc_sqlj.tar and from v11.1.3fp3_jdbc_sqlj.tar , however even in debug mode knime does not tell me the reason why the connect fails.
the jdbc url / user / password combination works fine in other db tools suc as dbeaver, squirrel sql or data studio.

This is what is in the log:
2019-01-17 00:32:09,737 : DEBUG : KNIME-Worker-16 : NodeContext : Database Connector : 0:3 : Workflow user found: stefan
2019-01-17 00:32:09,737 : DEBUG : KNIME-Worker-16 : RegisteredDriversConnectionFactory : Database Connector : 0:3 : Try to lock key to obtain connection: ConnectionKey [db-user=db2i1own, db-name=jdbc:db2://server:50000/MYDB, wf-user=stefan]
2019-01-17 00:32:09,737 : DEBUG : KNIME-Worker-16 : RegisteredDriversConnectionFactory : Database Connector : 0:3 : Connection found for key: ConnectionKey [db-user=db2i1own, db-name=jdbc:db2://server:50000/MYDB, wf-user=stefan]
2019-01-17 00:32:09,841 : DEBUG : KNIME-Worker-16 : RegisteredDriversConnectionFactory : Database Connector : 0:3 : Invalid connection found in cache with key: ConnectionKey [db-user=db2i1own, db-name=jdbc:db2://server:50000/MYDB, wf-user=stefan]
2019-01-17 00:32:09,841 : DEBUG : KNIME-Worker-16 : RegisteredDriversConnectionFactory : Database Connector : 0:3 : Closing connection with key: ConnectionKey [db-user=db2i1own, db-name=jdbc:db2://server:50000/MYDB, wf-user=stefan]
2019-01-17 00:32:09,841 : DEBUG : KNIME-Worker-16 : RegisteredDriversConnectionFactory : Database Connector : 0:3 : Removing closed connection from cache with key: ConnectionKey [db-user=db2i1own, db-name=jdbc:db2://server:50000/MYDB, wf-user=stefan]
2019-01-17 00:32:09,841 : DEBUG : KNIME-Worker-16 : RegisteredDriversConnectionFactory : Database Connector : 0:3 : Create new connection for key: ConnectionKey [db-user=db2i1own, db-name=jdbc:db2://server:50000/MYDB, wf-user=stefan]

Any ideas are very welcome on how to increase the log level and see what is actually going wrong here.

Hi,
another user had the same problem when using the db2jc.jar driver but once he used the db2jcc4.jar driver it worked. The reason is that with KNIME 3.5.3 we have added a more strict db connection validation which uses a JDBC 4.0 based method from the driver to check connection validity.
Please make sure that you have only registered the db2jcc4.jar and have removed the db2jcc.jar. You can also see in the log file which driver is used. If the error still persists send me you KNIME log via pm.
If you want to you can also try out our new DB framework which is available as preview via the KNIME Labs. The new framework supports several drivers for the same database and also allows you to adapt the connection validation method. For further details see the this post.
Bye
Tobias

2 Likes

Hi Tobias,
thank you for your answer!
It actually helped to use the jcc4.jar.
I also tried the DB Connector (Labs) Version and it worked as well.
I was sure that I tried it before but it may be that a KNIME restart is required for it to actually the use the other jar - it seems that changing it and applying is not enough.
Anyway it works now and Thanks again for your help!

2 Likes

Hi,
I’m glad it works now. Let us know if you have any further problems or ideas for the new db framework.
Bye
Tobias

1 Like