
PLZ SAY ME HOW TO INSERT THE VALUES INTO ORACLE THIS IS THE CODE:
import java.io.*;
import java.sql.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
public class emp1 extends JFrame implements ActionListener
{
private JTextField eid,ename,esal,eaddr;
private JButton submit;
public emp1()
{
setSize(300,300);
setVisible(true);
eid=new JTextField ("emp no here");
ename=new JTextField ("emp name here");
esal=new JTextField ("emp sal here");
eaddr=new JTextField ("emp eaddr here");
submit=new JButton("store");
submit.addActionListener(this);
Container c=getContentPane();
c.setLayout(new FlowLayout());
c.add(eid);
c.add(ename);
c.add(esal);
c.add(eaddr);
c.add(submit);
setTitle("add new emp1 Record");
}
public void actionPerformed(ActionEvent ae)
{
String veid,vename,vesal,veaddr;
veid=eid.getText();
vename=ename.getText();
vesal=esal.getText();
veaddr=eaddr.getText();
String sqlstmt="insert into emp1 values(' "+veid+" ',' "+vename+" ',' "+vesal+" ',' "+veaddr+" ')";
System.out.println(sqlstmt);
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","scott","tiger");
Statement stmt=con.createStatement();
stmt.executeUpdate(sqlstmt);
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
public static void main(String[] ar)
{
emp1 e=new emp1();
e.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
}
}
I GOT ERROR FOR THIS PROGRAM
ERROR:java.lang.ClassNotFoundException:oracle.jdbc.driver.OracleDriver
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.