hello exprts!! i am new 2 database!!! i have oracleXE and jdk 1.6.0_14 installed on windows XP!! i want 2 connect them via my java program.but i am gettting errors after executing the program.
my code is:
import java.sql.*;
//import oracle.jdbc.*;
//import oracle.jdbc.OracleDriver;
public class OracleConnect
{
public static void main(String[] args)throws SQLException
{
try
{
Class.forName("oracle.jdbc.OracleDriver");
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@HOST:1521:XE","hr","hr");
if(conn != null)
{ System.out.println("I am Connected to oracle database");
}
conn.close();
} catch (Exception e) {
System.out.println("ERROR : " + e);
e.printStackTrace(System.out);
}
}
}
i get the following error:
ERROR : java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at OracleConnect.main(OracleConnect.java:11)
plzz tell me how to solve this problem!!!