wood burning stoves 2.0*
The moose likes JDBC 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
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
internet detective

Joined: May 26, 2003
Posts: 30057

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

[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("com.ibm.db2.jcc.DB2Driver").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

subject: SQL Exception No suitable driver
Similar Threads
WAMP/Java/MysqlConnector Issue
Error in Automatic Creation of ODBC Data Source
Connecting Oracle 8x
Starting Hibernate (My First Hibernate program)