Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

Nescio

Programmer
May 22, 2003
7
CA
Hello, I've been banging my metaphorically banging my head again the wall all day attempting to use a simple servlet to connect to a db2 database and update a table. I eventually run into the Exception you see above.

I've read a couple of other forum posts from various forums and as far as I can tell I have eveything in order:

- My classpath is: .;C:\Program Files\SQLLIB\bin;C:\ServletDev;C:\tomcat 4.1\common\lib\servlet.jar;C:\Program Files\SQLLIB\java\db2java.zip;C:\jdk1.3.1_08\bin;C:\ServletDev; which I believe incorporates all of the directories I need.

- I have placed the db2java.zip file containing the proper driver in about every lib directory I could find in my tomcat folders

- I can make a connection to a database when I am not using a servlet.

- My servlets do run properly when I am not trying to connect to a database.

Here is the code for the helper class to my servlet file:

public class DatabaseUtil
{
public static void updateDatabase(String ID, String name)
throws ClassNotFoundException, SQLException
{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection con = DriverManager.getConnection("jdbc:db2:java");
Statement stmt = con.createStatement();
String upString = "INSERT INTO Surtable VALUES ('" + ID + "', '" +
name + "')";
stmt.executeUpdate(upString);
stmt.close();
con.close();
}
}

Any suggestions would be appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top