Hi
I have problem getting DB2 connection in my webapp.
I can get connection from a standalone java program, the same parameters do not work for my webapp.
Code:
====
public static Connection getConnection(){
String driver = “COM.ibm.db2.jdbc.app.DB2Driver”;
String url = “jdbc:db2:test”;
String userid = “user”;
String password = “pass”;
Connection connection = null;
try {
Class.forName(driver);
System.out.println(“Driver Loaded*******”);
connection = DriverManager.getConnection(url, userid, password);
System.out.println(“Connection successful!”);
}catch (Exception e) {
System.out.println(“error loading driver”);
e.printStackTrace();
}
return connection;
}
setenv.bat
=======
set CATALINA_HOME=C:\tomcat5
set CATALINA_OPTS=-mx128m
set PATH=$PATH:C:\SQLLIB\bin
set LIBPATH=$LIBPATH:C:\SQLLIB\lib
set LD_LIBRARY_PATH=C:\SQLLIB\lib
I get this ouput:
==========
Driver Loaded*******
error loading driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
catalina.bat
========
set CLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar;C:\SQLLIB\java\db2java.jar;
Can you please tell me where it went wrong.
Thanks
Modha/-