aspose file tools*
The moose likes JDBC and the fly likes What is this No Suitable Driver exception? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "What is this No Suitable Driver exception? " Watch "What is this No Suitable Driver exception? " New topic
Author

What is this No Suitable Driver exception?

Ja vardhan
Ranch Hand

Joined: May 09, 2005
Posts: 169
Hi,

When I am using the code:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

getting No Suitable Driver SQL Exception.

When I am using other driver:

Class.forName("oracle.jdbc.driver.OracleDriver");

getting the exception java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver.

I am writing just simple program trying to connect to Oracle database.
But I am gettign exception with Class.forName() method as specified above.

What might be the problem?
We need to have installed any driver on our machine when we are using connection driver?
What are the basic requirements when we are writing JDBC program?

Please post your ideas.

Thanks.


Javardhan:
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
You certainly need at least a jar in your classpath with the driver classes in it.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
In the case of the Oracle driver, you're missing the class in your classpath, as was suggested before. In the case of the JDBC/ODBC bridge, it sounds like the URL you're using to access the DB is incorrect.


Ping & DNS - updated with new look and Ping home screen widget
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is this No Suitable Driver exception?
 
Similar Threads
Setting the attribute
Registering the drivers
Not Suitable Driver Error
Exception in thread "main" java.sql.SQLException: No suitable driver
No suitable driver found for oracle:jdbc:thin:@localhost:1521:xe Exception ;Hibernate