
I have done a code with database connectivity with driver 4,it copiles,but while running it is showing java.lang.ClassNotFound exception..the code is following...
import java.sql.*;
class JdbcDemo1
{
static Connection con=null;
public static void main(String args[])
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521","system","123");
System.out.println("connection established");
Thread.sleep(1000);
Statement stmt=con.createStatement();
String createTable="create table test(name varchar2(20),fname varchar2(20))";
stmt.executeUpdate(createTable);
System.out.println("Table created successfully");
Thread.sleep(1000);
String insertQuery="insert into test values('raja','papa')";
stmt.executeUpdate(insertQuery);
System.out.println("Records inserted successfully");
Thread.sleep(2000);
System.out.println("Plz,wait....data is fetching...");
Thread.sleep(2000);
ResultSet rs=stmt.executeQuery("select * from test");
while(rs.next())
{
System.out.println("name = "+ rs.getString(1) + "fname = "+ rs.getString(2) );
}
}
catch (Exception e1)
{
e1.printStackTrace();
}
finally
{
try
{
con.close();
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
}
}.....end of code
please help me out as soon as possible...i m waiting...and i m using oracle 11g as database.

hi friend,
Probably you aren't deploying the oracle driver with your application.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.