LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   JDBC with Tomcat and DB2 just won't work. (https://www.linuxquestions.org/questions/linux-enterprise-47/jdbc-with-tomcat-and-db2-just-wont-work-198855/)

proto_frosty 06-28-2004 07:13 PM

JDBC with Tomcat and DB2 just won't work.
 
Hello,

I'm trying to get Tomcat 4.1.24 to talk to DB2 v7.1, this is all running on a virtual suse box (9.1). They're letting me use Tomcat instead of Websphere but I still have to use DB2. At least its linux :)

I feel Tomcat isn't to blame as I can't get it to work from a normal java programq and Tomcat is setup correctly and serves non JDBC JSPs fine. This is what I'm trying to run, its just too lines really witha lot of error checking

CODE:

import java.sql.*;
//import COM.ibm.db2.*;

public class JDBCtest{

public static void main(String[] args){

System.out.println("Starting test");

try{

System.out.println("Loading Driver");
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
System.out.println("Driver loaded");

try{

System.out.println("Getting connection");
Connection databaseConnection = DriverManager.getConnection("jdbc:db2:eventod","db2inst1","*******");
System.out.println("Connection obtained - about to close it");
databaseConnection.close();
System.out.println("Connection closed");

}catch(Exception e){
System.out.println("<br>Had an error on line 2!!!");
System.out.println(e.toString());
}
}catch(Exception e){

System.out.println("<br>Had an error on line 1!!!");
System.out.println(e.toString());

}

System.out.println("Test endded");

}

END CODE

In the same directory as this I have the contents of DB2Java.zip which came from the DB2 install. The drive loads but when I try to make a connection I get an error 'Driver not suitable'. The database 'eventod' exists and I can run sql against it from the DB2 command promt. I have no idea whats wrong.


All times are GMT -5. The time now is 07:34 PM.