aspose file tools*
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
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Exception No suitable driver" Watch "SQL Exception No suitable driver" New topic
Author

SQL Exception No suitable driver

Ram cherla
Greenhorn

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:
Class.forName("com.ibm.db2.jcc.DB2Binder");
String url = "jdbc b2://servername ortNumber/databaseName";
conn = DriverManager.getConnection(url,userId,passwd);
-----

Thanks,
-Ram
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29245
    
139

Ram,
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
Greenhorn

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

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.
-Ram
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

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

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Exception No suitable driver
 
Similar Threads
Starting Hibernate (My First Hibernate program)
NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
Connecting Oracle 8x
Error in Automatic Creation of ODBC Data Source
WAMP/Java/MysqlConnector Issue