This blog is for the first time users or freshers in using oracle11g release2 and it also deals with the connectivity of java with oracle11g.
import java.io.*;
import java.sql.*;
public class OraThin
{
public static void main(String[] args)
{
try
{
Connection con=null;
Class.forName("oracle.jdbc.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@::","","");
Statement s=con.createStatement();
s.execute("create table THEMASK(log_id number,name varchar(10)) ");
s.close();
con.close();
} catch(Exception e)
{
e.printStackTrace();
}
}
}
PROBLEM: if you get the error which reads like "NoClassDefFound"
Reason: it simply that your oracle database driver is not been located by your javacode. "ojdbc14.jar" is the file which is file that we are looking for .. this file is responsible for creating a connection between your java pragram Oracle database.
Recommended Action: simply make a search for ojdbc14.jar in your computer .. copy the address from the address bar i.e. the location of this file and add it in PATH and CLASSPATH as well. this should solve the problem.
