Connect to DB2 database in eclipse via jdbc

☆樱花仙子☆ 提交于 2019-11-29 05:12:21

I was getting the same error. I was running it using java 8, I switched to Java 7 and it worked.

What Version of driver do you use? I encountered the same problem with Java 1.8 and driver version 2 (named db2jcc.jar). Using the driver version 4 (named db2jcc4.jar) it works flawlessly. Be sure, when using e.g. tomcat, that only the right driver is persistent in the lib-directory. If both drivers are persistent, it will strictly use the old one (version 2).

Try to use the direct connection from the driver, having the same classpath and user. In this way you can ensure that your environment is correctly configured, and the problem is from Java.

http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.apdv.java.doc/src/tpc/imjcc_rjv00004.html

java com.ibm.db2.jcc.DB2Jcc -url jdbc:db2://mysys.myloc.svl.ibm.com:446/MYDB -user db2user -password db2pass -tracin

You can even configure this line in Eclipse, by passing the parameters in the "Run..." dialog, and using the same classpath as you run your app.

Augustine Joseph

After I change the DB2 jar to db2jcc4-9.7.jar it works correctly without any issue.

The JDK version that I am using is 1.8.0_131

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!