This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes SQL Exception No suitable driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQL Exception No suitable driver" Watch "SQL Exception No suitable driver" New topic

SQL Exception No suitable driver

Ram cherla

Joined: Jul 17, 2002
Posts: 6
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:
String url = "jdbc b2://servername ortNumber/databaseName";
conn = DriverManager.getConnection(url,userId,passwd);

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 31585

Is there a reason you aren't using the standard driver?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ram cherla

Joined: Jul 17, 2002
Posts: 6
statement.setQueryTimeOut() and cancel was not implemented in standard type2 driv.
Ram cherla

Joined: Jul 17, 2002
Posts: 6
Hello All,
SQL Exception No suitable driver probelm got fixed. I was using wrong class while loading driver.
Correct one is: Class.forName("").newInstance();

Thanks for your help.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

While typically not important, the .newInstance() is not required unless you're still developing in Java 1.1

jQuery in Action, 2nd edition
subject: SQL Exception No suitable driver