• 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

DB2 driver

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I just downloaded DB2 UDB version 8 trial version & tried to access the database (I used the following code to register and load the driver), but I get an error that package COM.ibm.db2.jdbc.app doesn't exist. I have added the db2jcc.jar and sqlj.zip files in my classpath.
DriverManager.registerDriver(new COM.ibm.db2.jdbc.app.DB2Driver());
Class db2Driver = Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Could anybody who has worked on DB2 can give me some pointers about this error? I tried to find the class file DB2Driver myself in all the library files that came with DB2, but I didn't find the one required :-(
I found only one DB2Driver class file in db2cc.jar which is in package com.ibm.db2.jcc
Any help is greatly appreciated.
Thanks,
Vidya.
 
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
The files you are looking for are in db2java.zip. On my machine, it's in .../sqllib/java/db2java.zip.
 
Vidya Ram
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jeanne. I can compile the code now but it gives an "SQL exception:No suitable driver found".
Could you please let me know what could be wrong?
 
Jeanne Boyarsky
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
That could be one of many problems.
1) What IDE are you using or are you using the command line?
2) Are you accessing the database from JDBC or EJBs?
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the URL that you are using? It should look like:

DriverManager.getConnection("jdbc b2:<database_name>", "<user>", "<pass");

FYI -
default user and pass are "dba", "dba" and "db2admin", "db2admin" for DB2...
 
Vidya Ram
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Jeanne and Dana, it works fine now.
I am using command line and using JDBC to access the database.
I was trying with the URL jdbc b2://localhost:50000/Vidya","dba","dba" Then it gave me that error. I was under the impression that I should specify the port number also as we do for Oracle...
Thanks again.
Vidya.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic