JDBC driver problem
Date: 16 Dec 2003 04:07:54 -0800
Message-ID: <d6193773.0312160407.39c45273_at_posting.google.com>
Hello,
my Java-program can't load the JDBC driver.
I always get a java.lang.NoClassDefFoundError when I run it.
The JDBC Driver is in the directory: C:\programs\ora92\jdbc\lib
I think I have to set ORACLE_HOME environment variable and CLASSPATH,
but I have no idea how ?????????
Thanks
Axel
import java.sql.*;
class Employee
// Connect to the database
// Create a Statement
// Select the ENAME column from the EMP table
program:
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// You can put a database name after the _at_ sign in the connection URL.
Connection conn =
DriverManager.getConnection
("jdbc:oracle:oci8:_at_axel-0560nntbn1:1521:oracle", "scott", "tiger");
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));
// Close the RseultSet
rset.close();
// Close the Statement
stmt.close();
// Close the connection
conn.close();
}
}
Received on Tue Dec 16 2003 - 13:07:54 CET