• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Exception No suitable driver

 
Ram cherla
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While typically not important, the .newInstance() is not required unless you're still developing in Java 1.1

Dave
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic