Monday, November 14, 2011

java.lang.ClassNotFoundException: COM.ibm.db2.jdbc.app.DB2Driver

If you get below mentioned error


Exception in thread "main" java.lang.ClassNotFoundException: COM.ibm.db2.jdbc.app.DB2Driver
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)

Possible reason could be you forgot to add db2java.jar file in classpath. Please cross check if the jar file db2java.jar is added in class path.

Also make sure that driver name is in proper case, as Driver name case sensitive. i.e. COM.ibm.db2.jdbc.app.DB2Driver (Note that COM is in upper case)

To download Jar file : Click here

No comments:

Post a Comment