Hello Mark
I think you are right Mark when You say that, it is do finding the db2jaa.jar/zip file but question is why it is not getting "COM.ibm.db2.jdbc.app.DB2Driver" which is placed in db2java.zip/db2java.zip.jar file. This is the source code of the file I am trying to run undr tomcat import java.sql.*; import java.lang.*; import java.io.*; public class Ndb2servlet{ public static void main(String args[]) { try{ Class.forName ("COM.ibm.db2.jdbc.app.DB2Driver").newInstance(); } catch( Exception e) { System.out.println("\nDriver class not found exception"); } try{ Connection con = null; // URL is jdbc:db2:dbname String url = "jdbc:db2:sample"; if (args.length == 0) { // connect with default id/password con = DriverManager.getConnection(url); } else if (args.length == 2) { String userid = args[0]; String passwd = args[1]; // connect with user-provided username and password con = DriverManager.getConnection(url, userid, passwd); } else { System.out.println("\nUsage: java Ndb2servlet [username password]\n"); System.exit(0); } // retrieve data from the database System.out.println("Retrieve some data from the database..."); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT * from db2admin.employee"); System.out.println("Received results:"); while (rs.next()) { String a = rs.getString(1); String str = rs.getString(2); System.out.print(" empno= " + a); System.out.print(" firstname= " + str); System.out.print("\n"); } rs.close(); stmt.close(); con.close(); } catch (SQLException e1) { System.out.println("SQL Exception: "+ e1.getMessage () + "\n"); } } } ------------------------------------------------------------------------------------ Nishant Awasthi Corporate Systems Development Progressive Insurance "Sullivan, Mark E" <Mark.Sullivan@nav-internat To: 'Tomcat Users List' ional.com> <[EMAIL PROTECTED]> cc: (bcc: Nishant Awasthi) 07/31/2002 10:41 AM Subject: RE: Connection between TOMCAT and Please respond to "Tomcat DB2 ??? Users List" If your db2driver.zip/jar file was not being found, then it would through a ClassNotFoundException. Your error is due to using an invalid connection string for the kind of driver you are using. For example, using the following combination will through a no suitable driver exeception: String conn = "jdbc:db2://obtasdne/FLBP"; Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"); con = DriverManager.getConnection(conn); This is an example of where you should use the .net driver. Check your connection string. That's where your problem is -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 9:35 AM To: Tomcat Users List Subject: RE: Connection between TOMCAT and DB2 ??? Hello Mark, I am currently using "COM.ibm.db2.jdbc.app.DB2Driver" driver to run my simple java program for establishing DB2-Tomcat connectivity. I tried changing it to "COM.ibm.db2.jdbc.net.DB2Driver" still it says, No suitable driver I think my tomcat is not able to find out db2java.zip file which is placed in C:\Program Files\SQLLIB\java DO I need to add some contextpath in server.xml of TOMCAT to tell tomcat to look for DB2 jdbc driver in %SQLLIB%\java directory? I was looking at server.xml in TOMCAT and found that there is something called <Realm /> comment above which says <!-- Replace the above Realm with one of the following to get a Realm stored in a database and accessed via JDBC --> I tried changing it to DB2 compatible information..but didn't worked...I had problem starting tomcat... Can you guide me in some other way? ---------------------------------------------------------------------------- -------- Nishant Awasthi Corporate Systems Development Progressive Insurance "Sullivan, Mark E" <Mark.Sullivan@nav-internat To: 'Tomcat Users List' ional.com> <[EMAIL PROTECTED]> cc: (bcc: Nishant Awasthi) 07/31/2002 09:54 AM Subject: RE: Connection between TOMCAT and Please respond to "Tomcat DB2 ??? Users List" Who's DB2 jdbc driver are you trying to use? If you're using the IBM implementation, you can either load the "COM.ibm.db2.jdbc.net.DB2Driver" or the "COM.ibm.db2.jdbc.app.DB2Driver" If you use the wrong one, you will get a No suitable driver exception. The correct one depends on the situation, and in this case it's probably the .net one. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 8:46 AM To: Tomcat Users List Subject: RE: Connection between TOMCAT and DB2 ??? Hello John, It was a nice thinking but I didn't worked. It is not finding the driver even now...I tried printing the classpath..though it shows the all 3 ".jar" files included but it is working only in %SQLLIB%\bin directory that is if I try to run my file by keeping it in %SQLLIB%\bin directory it worked fine and retieve resultsets from database but not from TOMCAT_HOME directory... Any other tries..? ---------------------------------------------------------------------------- -------- Nishant Awasthi Corporate Systems Development Progressive Insurance "Turner, John" To: 'Tomcat Users List' <JTurner@AAS. <[EMAIL PROTECTED]> com> cc: (bcc: Nishant Awasthi) Subject: RE: Connection between TOMCAT and 07/31/2002 DB2 ??? 09:27 AM Please respond to "Tomcat Users List" Try renaming your .zip files to .jar files. Just change the extension from .zip to .jar without changing the files themselves. John Turner [EMAIL PROTECTED] -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 9:22 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Connection between TOMCAT and DB2 ??? Hello everyone... thanks for showing interest in the list and to make it grow... I have a situation here. I am using tomcat 4.0.3 and jdk 1.3.1_04. I want to write a soap service which will bring the resultset from IBM DB2 database. Before implementing soap I am writing a simple Java "Ndb2servlet.java" file inside %TOMCAT_HOME%\webapps\soap\WEB-INF\classes Now it compile fine but when I try to run it it says: >>>>> COMPILING >>C: \jakarta-tomcat-4.0.4\webapps\soap\WEB-INF\classes>javac Ndb2servlet.java >>>>> RUNNING >>C:\jakarta-tomcat-4.0.4\webapps\soap\WEB-INF\classes>java Ndb2servlet SQL Exception: No suitable driver I have tried to put db2java.zip, runtime.zip and sqlj.zip in %TOMCAT_HOME% \common\lib and and also included in system classpath then restarted TOMCAT but still it couldn't find driver. DO I need to do something special for my JAVA file in tomcat to find "DB2driver" Please help.... thanks ---------------------------------------------------------------------------- -------- Nishant Awasthi Corporate Systems Development Progressive Insurance -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>