• 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

SQL Exception No suitable driver

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

While using DB2 UDB V8.1 type4 driver, i was getting below error.
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)

Do you know why? I checked in the classpath, db2jcc.jar is in classpath.
---
partial code:
Class.forName("com.ibm.db2.jcc.DB2Binder");
String url = "jdbc b2://servername ortNumber/databaseName";
conn = DriverManager.getConnection(url,userId,passwd);
-----

Thanks,
-Ram
 
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
Ram,
Is there a reason you aren't using the standard driver?
 
Ram cherla
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
statement.setQueryTimeOut() and cancel was not implemented in standard type2 driv.
 
Ram cherla
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,
SQL Exception No suitable driver probelm got fixed. I was using wrong class while loading driver.
Correct one is: Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();

Thanks for your help.
-Ram
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While typically not important, the .newInstance() is not required unless you're still developing in Java 1.1

Dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic