• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC driver,Tomcat,DB2 Problem

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,I am trying to access DB2 with JDBC driver in the
tomcat3.3 server.Following is the code:
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
conn = DriverManager.getConnection(
"jdbc:db2:BankDB",userid,passwd);
I also include the db2java.zip in the CLASSPATH.
When I run a simple java application with above code
to test the database access,it works.But when I
use it in a servlet from Tomcat,I got the
ClassNotFoundException Error.It seems the server can
not get the driver.
I checked old posts in JavaRanch and still can not
get a clear solution.I also ran the usejdbc2.bat in
DB2.
Any advice?
Do I need to install the DB2 client in the machine?
Right now the DB2 server,Tomcat server and all programs
are in the same Win2000 box.
Thanks
 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using Tomcat 4.x. I had a similar problem when accessing my Access database. The problem is with the classpath settings.
Here is what I suggest you try out. In the bin directory you should see catalina.bat. Open it up. Under that you should see the following lines
rem ----- Set Up The Runtime Classpath ----------------------------------------
set CP=%CATALINA_HOME%\bin\bootstrap.jar;%JAVA_HOME%\lib\tools.jar
if "%JSSE_HOME%" == "" goto noJsse
set CP=%CP%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar
:noJsse
set CLASSPATH=%CP%
*Replace the last line with*
set CLASSPATH=%CP%;%CLASSPATH%
Let me know if this works.
Ravi

 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try renaming the zip file to jar.

Reference this post: http://www.javaranch.com/ubb/Forum56/HTML/000041.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic