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!

ClassNotFoundException: oracle.jdbc.driver.OracleDriver

14057Sep 28 2001
Dear All:
I have some problems on using Oracle JDBC Driver.
I have downloaded classes12.zip and nls_charset12.zip and set
the class path as [ORACLE_HOME]\jdbc\lib\classes12.zip and
[ORACLE_HOME]\jdbc\lib\nls_charset12.zip and added [ORACLE_HOME]
\jdbc\lib to the PATH. Also I have installed Oracle8i Client
8.1.5.0.0. Then I tried to compile a simple java program.
However, these errer messages occured when i run the program:

ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Exception in thread "main" java.sql.SQLException: No suitable
driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at JdbcTest.main(JdbcTest.java:16)

The following is the program code:
import java.sql.*;

class JdbcTest {
public static void main (String args []) throws SQLException
{
// Load Oracle driver
try {System.out.println("line7");
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}System.out.println("line12");

// Connect to the local database
Connection conn = DriverManager.getConnection

("jdbc:oracle:oci8:@128.128.152.189:1521:ORCL","xxx", "xxx");
// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("SELECT ename FROM emp");
// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));

//close the result set, statement, and the connection
rset.close();
stmt.close();
conn.close();
}
}

why the program can't find the jdbc driver, as i have followed
the setting from the readme doc.

Thanks very much

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 31 2001
Added on Sep 28 2001
5 comments
1,385 views