OracleDriver - ClassNotFoundException with ojdbc14.jar
843854Aug 3 2004 — edited Aug 4 2004Hello. If you guys have a minute, I could use some help. I've been trying to establish a simple connection from my new laptop to an Oracle box on the network. I've created this simple script to test it out...
import java.sql.*;
class JDBCTest {
public static void main (String args []) {
Connection conn=null;
// Load Oracle driver
try {
Class.forName("oracle.jdbc.driver.OracleDriver()").newInstance();
// Connect to the local database
conn = DriverManager.getConnection ("jdbc:oracle:thin:@oracle:1521:oracle","scott", "tiger");
System.out.println("connected");
}catch(SQLException se){
System.out.println(se);
}catch(Exception e){
System.out.println(e);
}
}
}
I've donloaded the Oracle JDBC driver and put the jar into the c:\java\bin file directory...which is the same directory that I am compiling the source code above in. I use the following two command line statements to compile and run...
C:\java\bin>javac JDBCTest.java
C:\java\bin>java JDBCTest -classpath c:\java\bin\ojdbc14.jar
Compilation goes ok but I get a ClassNotFoundException when it tries to create a new instance of the Oracle Driver. I've been banging at this for a while so any kind of help is really appreciated.