Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.sql.SQLException:No Suitable Driver

837080Feb 4 2011 — edited Feb 5 2011
I am be able to connect to Oracle Database via JDeveloper 10g GUI interface with this url:
"jdbc:oracle:thin:@mycompanyhost:1521:SID".

However, when I put this url into the code, I'd get run-time error:
java.sql.SQLException:No Suitable Driver:
at java.sql.DriverManager.getConnection(DriverManager.java:532)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at DB.mypackage.DBQuery.main(DBQuery.java:32)

I added this line in my code to register oracle driver: " DriverManager.registerDriver (new oracle.jdbc.OracleDriver());" But I got an error:"Variable oracle.jdbc.OracleDriver cannot be found." I also added path to jdbc where is has ojdbc5.jar and ojdbc6.jar reside in the environmental variable.

I am new to java app development and have exausted all my knowledge and options. Please advise.

Edited by: 834077 on Feb 4, 2011 3:03 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 5 2011
Added on Feb 4 2011
6 comments
14,097 views