469,336 Members | 5,892 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

DB2 Driver- ClassNotFoundException-Please help

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
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
1 1639
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.

Similar topics

8 posts views Thread by Tux | last post: by
6 posts views Thread by Philip | last post: by
1 post views Thread by rguti | last post: by
reply views Thread by CS Loh | last post: by
2 posts views Thread by Raquel | last post: by
12 posts views Thread by Steve | last post: by
5 posts views Thread by insomniux | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.