JDBC - Application 2

Store Data In  Table Student :

















import java.sql.*;
import java.awt.*;
import java.awt.event.*;
class TableCreate2 implements ActionListener
{
    Statement s;
    Frame f;
    TextField tf1, tf2, tf3;
    Label l;
    Button b1, b2, b3;
    Dialog d;
    Panel p;
    String s1, s2, s3;
    int a;
    TableCreate2()
    {
        try
        {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            Connection c = DriverManager.getConnection("Jdbc:Odbc:Maya");
            s = c.createStatement();
           
            f = new Frame();
            tf1 = new TextField(10);
            tf2 = new TextField(10);
            tf3 = new TextField(10);
            b1 = new Button("INSERT");
            b2 = new Button("OK");
            b3 = new Button("CANCEL");
            d = new Dialog(f,"Inserting Data?");
            l = new Label();
            p = new Panel();
            f.setLayout(new FlowLayout());
            f.add(tf1);
            f.add(tf2);
            f.add(tf3);
            f.add(b1);
            p.add(l);
            p.add(b2);
            p.add(b3);
            d.add(p);
            d.setSize(250,250);

            b1.addActionListener(this);
            b2.addActionListener(this);
            b3.addActionListener(this);
            f.setSize(400,400);
            f.setVisible(true);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
    public void actionPerformed(ActionEvent e)
    {
        if(e.getSource() == b1)
        {
            s1 = tf1.getText();
            s2 = tf2.getText();
            s3 = tf3.getText();
            a = Integer.parseInt(s2);
            l.setText("Name : "+s1+"Id : "+a+"Address : "+s3);
            d.setVisible(true);
        }
        if(e.getSource() == b2)
        {
            try
            {
                s.execute("insert into Student values('"+s1+"',"+a+",'"+s3+"')");
                System.out.println("inserted");
                tf1.setText("");
                tf2.setText("");
                tf3.setText("");
                d.setVisible(false);
                tf1.requestFocus();
            }
            catch(Exception ce)
            {
                ce.printStackTrace();
            }
        }
        if(e.getSource() == b3)
        {
            d.setVisible(false);
            tf1.requestFocus();
        }
        f.repaint();
        f.validate();
    }
    public static void main(String[] args)
    {    TableCreate2 x = new TableCreate2();    }
}