File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Connectind DB2 from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connectind DB2 from Java" Watch "Connectind DB2 from Java" New topic
Author

Connectind DB2 from Java

Hd Desai
Ranch Hand

Joined: Aug 04, 2003
Posts: 65
Hi,

I am trying to connect to Db2 7 From my java application.

I am using this driver
COM.ibm.db2.jdbc.app.DB2Driver

But its giving me exception like
java.sql.SQLException: No suitable driver

Pls help me in this regard.

Thanks
Ranga Kalidindi
Greenhorn

Joined: Mar 04, 2005
Posts: 17
Naik,
You are gettig this exception because the driver class is not visible to your java application.
Include the db2java.zip (present in the local machine) in the class path (if you are using WSAD, it is 'build path') of your application.

rgds,
Rangaraju.K
Hd Desai
Ranch Hand

Joined: Aug 04, 2003
Posts: 65
Hi,

Thnx a lot for ur reply.

I have included db2java.zip in my classpath in WSAD.Still it is giving error.

IS there anything else we need to check?
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1131

Naik,
You didn't mention (in your original post) that you were using WSAD -- WebSphere Application Developer, right?

WSAD doesn't use your CLASSPATH -- D'OH

Maybe someone who uses WSAD can tell you how to modify the CLASSPATH used by WSAD.

(Or is there something else you still haven't told us?)

Good Luck,
Avi.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30370
    
150

Originally posted by Avi Abrami:
Maybe someone who uses WSAD can tell you how to modify the CLASSPATH used by WSAD.

Each project has it's own classpath. I think the classpath Naik was referring to was the list of classpath variables. You need to update the build path for the project with the JDBC calls to include db2 as Ranga suggested.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Hd Desai
Ranch Hand

Joined: Aug 04, 2003
Posts: 65
Hi,

By mistake i wrote classpath.

I have included in Build path of WSAD only.But still its giving error as "ClassNotFoundException"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Connectind DB2 from Java