473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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
{
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.
Jul 3 '07 #1
1 1736
Mulder
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.

mulder
Jul 4 '07 #2

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

Similar topics

8
by: Tux | last post by:
Is it possible and does someone try to make driver for Linux in Java, for some USB device? Could Java do that ? I saw jUSB package but it seems that works only with the devices which Linux...
6
by: Philip | last post by:
Hi, i'am looking for a db2 driver for windows the DB2 servers runs on as400 if that makes any difference. Thanks, Philip
3
by: David | last post by:
Hello all, I have been trying to use the OCI driver to connect to Oracle 9i, but have been getting the following error: java.sql.SQLException: Closed Connection at...
1
by: rguti | last post by:
Anybody know when the new version of the ODBC Driver is gonna be out? I'm using 3.51.11-1, but I'm having problems transferring information from SQL Server. Thanks.
0
by: CS Loh | last post by:
Hi, I install a filter driver through INF file to a 3rd party audio device (with driver). The filter driver works well on the 3rd party driver. However upon uninstallation of the filter driver,...
2
by: Raquel | last post by:
Read this about the Universal JDBC Driver.... "In a Type 2 mode, the Universal JDBC driver provides local application performance gains (because it avoids using TCP/IP protocol to communicate to...
1
by: MLH | last post by:
I'm running XP. Is it required that a given ODBC driver be selected or set somehow as a default driver? Look at this... Here's the error: Error: ODBC call failed... Datasource not found and no...
12
by: Steve | last post by:
I wrote a simple virtual device driver int15.sys, Is C# support load the device driver from AP?
8
by: Dakkar | last post by:
I wrote a program with c# for connecting mysql and taking data from it but when someone without me try to execute the program they are taking this error ERROR Data source name not found and...
5
by: insomniux | last post by:
Hi, I need to install an ODBC driver for a database, but our system- administrator does not allow me to install it on the VPN-server. Is there a way to install an ODBC driver for a separate user....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.