This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am trying to connect to a DB2 on a AS400 from Windows2000 professional system using a small JSP code on Tomcat4.0.1. This is the error I get... Exception: javax.servlet.ServletException: COM.ibm.db2.jdbc.app.DB2Driver **blah blah blah** Root cause: java.lang.ClassNotFoundException: COM.ibm.db2.jdbc.app.DB2Driver **blah blah blah** I fetched the db2_classes.jar file from the AS400 and defined it in the CLASSPATH.But to no avail. Do I have to use some other JDBC drivers? I would appreciate any assistance in this context... Thanks
Hi Krish, The exception says that it can not find the class 'COM.ibm.db2.jdbc.app.DB2Driver'. Try unjaring the jar file to some temp directory and see if that class is present in the jar file. I dont know if this is correct approach but just give it a try. Regards, Sim Sim
Thank u people for the suggestions. I extracted the zip file and moved the class files under COM/ibm to the CLASSES sub-directory of Tomcat and that eradicated the error message. Now the error message I have is exception javax.servlet.ServletException: No suitable driver ---blah blah blah--- root cause java.sql.SQLException: No suitable driver ---blah blah blah--- In the jsp page I am using "Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); to load the driver, is this the way to register the driver also OR is there any other way? Once again,sincere thanks to Sim Sim and Rene Larsen.
Did you put the classes under '<SOME_WEBAPP>/WEB_INF/classes'? you could also put the jar/zip file in the directory '<SOME_WEBAPP>/WEB_INF/lib' you just have to remember that the extention must be jar. Rene
"Krish P", The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp. We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please edit your profile and select a new name which meets the requirements. Thanks. Dave
Joined: Jul 31, 2002
Hello, I have put the requisite classes in and I still get the error. I have also checked for the correct URL syntax that I pass to Driver.getConnection. I cant think of any other areas. The JSP code I am using is pretty simple and straightforward. Any suggestions? Thanks yet again to Rene Larsen...