i am expected to connect to database and for that purpose the following program is written.
import java.io.*;
import java.util.*;
import sun.jdbc.*;
public class Oracle_dbconnectivity {
public static void main(
String[] args) {
new Oracle_dbconnectivity();
}
public Oracle_dbconnectivity(){
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver Registered");
System.exit(0);
}
catch(ClassNotFoundException cnfe){
cnfe.printStackTrace();
System.exit(-1);
}
}
}
Output :java.lang.ClassNotFoundException: oracle.jdbc.driver.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 Oracle_dbconnectivity.<init>(Oracle_dbconnectivity.java:21)
at Oracle_dbconnectivity.main(Oracle_dbconnectivity.java:16)
the version of oracle 8 is used . it is installed in E: drive.\\
"when i searched for the file java1java2 i found jdbc\odbc:" .
from file called jdbcodbc.dll which is present in E:\ORANT\BIN
but still the exception continues.
now do i connect to the database.
so how should i solve this problem.