• 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

Connectind DB2 from Java

 
Ranch Hand
Posts: 65
  • 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 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
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic