hi,
i'm fairly new to java. i'm trying to connect to an oracle database but it's giving me the following error:
C:\JSPTests>java RPASelect
ClassNotFoundException: oracle.jdbc.driver.OracleDriver
SQLException: No suitable driver
i have j2sdk1.4 installed on my Windows NT 2000. i don't have any oracle installed on my machine. i'm basically connected to our office network. i'm not the oracle admin. i also read about the classes111.zip but i don't know if it applies to me since i'm not running oracle on my local machine. i also trying running the same code connecting to MS Access (changing what i need to change) and i get results. however, when i try modify the program to connect to oracle. i get the message above. what am i doing wrong? thanks for any help. i'm also using "thin".
here's the code i'm using:
import java.sql.*;
import java.util.*;
import java.awt.*;
public class RPASelect {
public static void main(String args[]) {
String url = "jdbc:oracle:thin:@nnnn:nnn:nnnnn";
Connection con;
String queryString;
queryString = "select * from RPA_RESOURCE where RPA_RESOURCE.COLCD = '**'";
Statement stmt;
ResultSet rs;
try {
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
//Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("JDBC driver loaded");
}
catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url, "myID", "myPass");
stmt = con.createStatement();
rs = stmt.executeQuery(queryString);
while (rs.next())
out.println(rs.getString(1));
stmt.close();
con.close();
}
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
I've read some people said I need to download classes111.zip or jbdc14.jar from
www.oracle.com. Is this applicable to my setup which I describe above? If in fact I need it, where to I install the file on my PC? Which one to I really need (classes111.zip or jbdc14.jar)? I'm getting confused. Please advise. Thank you in advance.
Paul