|
 |
pro_jsp thread: Java and Oracle connection unders Unix sys
Message #1 by "Anders Wong" <kwok@s...> on Mon, 21 May 2001 08:58:21
|
|
Hi there, I try to connect Oracle database with Java, but I got an error
message when I ran the .class file
"java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at joracle.main(Compiled Code)"
import java.sql.*;
class joracle
{
public static void main(String args[]) throws SQLException,
ClassNotFoundException
{
try{
Class.forName ("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:rgbill/rgbill@p...:1521:ORP1");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select NAME from contacts");
while (rset.next())
System.out.println(rset.getString(1));
}
catch(SQLException e){System.err.println(e);}
}
}
Here is the unix classpath setting:
# oracle setting
setenv ORACLE_SID ORP1
setenv ORACLE_BASE /oracle
setenv ORACLE_TERM vt100
setenv ORACLE_HOME /oracle/app/oracle/product/805
setenv
LD_LIBRARY_PATH /oracle/app/oracle/product/805/lib:/oracle/app/oracle/produ
ct/805/jdbc/lib:.ob
setenv CLASSPATH
ORACLE_HOME/jdbc/lib/classes111.zip:/home/billing/anders:ORACLE_HOME/jdbc/l
ib/OracleDriver.class:/usr/java/li
b/:ORACLE_HOME/jdbc/lib/nls_charset11.zip:
Please give some hints to fix the problem.
Thank You
|
|
 |