File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes DB2 Connection error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "DB2 Connection error" Watch "DB2 Connection error" New topic

DB2 Connection error

Nils Persson

Joined: May 25, 2001
Posts: 21
I get the following error when I try to run my servlet, trying to connect to a DB2 database.

I have also tried net insted of app.
I use Tomcat 4.
I have the file in my classpath. Does Tomcat have its own classpath?
Should I put something in web.xml or server.xml?
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
My client has had simular errors about a month ago.
Need more information:
What version of java are you using?
What version of jdbc are you using?
What platform is you client running on?
What platform is db2 running on?
I check back in an hour or so?

Multi Platform Database Developer & DBA on E.S.T.
Graham Thorpe
Ranch Hand

Joined: Mar 25, 2002
Posts: 265
I think ur dsn name is not suitable for ur connection.Just u create new dsn name and test it .this is my advice only...
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Quick fix: rename the .zip to .jar and put it in the [ TOMCAT_HOME ]/common/lib directory.
Yes, Tomcat maintains its own 'classpath' (it actually has multiple ClassLoaders to manage borders between applications) and can automatically load archives. The problem with loading these archives is that it will only load jars and not zip files.
What you should do is rename it .jar and put it in the [ TOMCAT_HOME ]/webapps/[ CONTEXT ]/web-inf/lib directory. The difference is that the original fix will make it available to ALL web apps, the second will only make it available to a single web app. The second is the preferred solution.
I agree. Here's the link:
subject: DB2 Connection error
jQuery in Action, 3rd edition