• 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

java.sql.SQLException: No suitable driver in DB2 7.01

 
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 using DB2 7.01 client.And our database is on OS 390.

I am using this code to connect to database.

try {
String dbUserName = "";
String dbPassword = "";
String dbUrl = "";
String dbDriver = "";
dbUrl = "jdbc b2os390:ADDCDB2P";
dbUserName = "t4745kb";
dbPassword = "may02005";

Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection conn = DriverManager.getConnection (dbUrl,dbUserName,dbPassword);

}
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(SQLException sqle) {
sqle.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}


} // End of getNewConn()

But its giving me following exception

java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:563)
at java.sql.DriverManager.getConnection(DriverManager.java:194)
at com.dcx.parts.ao.Test.getNewConn(Test.java:63)
at com.dcx.parts.ao.Test.main(Test.java:39)


My db2java.zip is in buildpath of WSAD 5.1

Pls help me in this regard.

Thnx
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your URL is blank (the String dbUrl). You will need to give theDriverManager a valid URL for your database.
 
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,

i have alredy assigned a value to that variable.

You can check

dbUrl = "jdbc b2os390:ADDCDB2P";

in code,its already there.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah sorry, missed that (why do you create a blank string, then create another with the correct value in it? ).

Well this error occurs when either your jdbc URL is unrecognized (which doesn't look like the case) or your driver in not in the classpath of you applciation. You say you include it in the "buildpath" for WSAD. Is that the same thing as the classpath WAS uses?
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this correct:



I've never seen a package name start with "COM", I would have expected to see "com".... Package/Class names are case-sensitive.

Also, I only have old code for this type of thing, and maybe it's not necessary anymore, but i use:



where "driverClassName" is a String holding the package/class name for the driver.

And then I'm able to use "DriverManager.getConnection()...".

Hope this helps.

--Jon
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your url set with a colon after the jdbc like this?
jdbc:b2os390:ADDCDB2P

Also make sure your db2java.zip is in your classpath.

I hope this helps.

-Joe
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic