aspose file tools*
The moose likes JDBC and the fly likes Gimme a hand pahdner!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Gimme a hand pahdner!!!" Watch "Gimme a hand pahdner!!!" New topic
Author

Gimme a hand pahdner!!!

Krish Pat
Ranch Hand

Joined: Jul 31, 2002
Posts: 32
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
sim sim
Ranch Hand

Joined: Jun 05, 2002
Posts: 55
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
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

The name of the JDBC zip file for DB2 is '<SOME_PATH>/SQLLIB/java/db2java.zip'
Rene
[ August 02, 2002: Message edited by: Rene Larsen ]

Regards, Rene Larsen
Dropbox Invite
Krish Pat
Ranch Hand

Joined: Jul 31, 2002
Posts: 32
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.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

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
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"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
Krish Pat
Ranch Hand

Joined: Jul 31, 2002
Posts: 32
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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Gimme a hand pahdner!!!