By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,779 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,779 IT Pros & Developers. It's quick & easy.

DB2 Driver- ClassNotFoundException-Please help

P: 7
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\;C:\jdk1.3.1_08\bin;C :\ServletDev; which I believe incorporates all of the directories I need.

- I have placed the 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
Connection con = DriverManager.getConnection("jdbc:db2:java");
Statement stmt = con.createStatement();
String upString = "INSERT INTO Surtable VALUES ('" + ID + "', '" +
name + "')";

Any suggestions would be appreciated.
Jul 3 '07 #1
Share this Question
Share on Google+
1 Reply

P: 5
just a suggestion...
try using a seperate Classloader and load the class directly out of the zip/jar file

i always use this method because i have to connect to different db2 database versions where the classname is the same.

Jul 4 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.