Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connectind DB2 from Java

 
Hd Desai
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Hd Desai
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

By mistake i wrote classpath.

I have included in Build path of WSAD only.But still its giving error as "ClassNotFoundException"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic