title: JDBC is not working for data insertion?
body: <p>I'm inserting data from user input from JFrame which is called by another JFrame class. I have checked the query in Oracle 11g express edition, it is showing no data is inserted.any one can modify this by adding main method in this code.</p>
  
  <pre><code>class Insert extends JFrame{
      JLabel name,code,address,telephone,email;
      JTextField tname,tcode,ttelephone,temail;
      JButton save,exit;
      JTextArea taddress;
      Insert(){
          //properties of frame
          super("CUSTOMER MASTER");
          setVisible(true);
          setLayout(null);
          setSize(1100,500);
          setResizable(false);
          //Initialisation
          name=new JLabel("Name:");
          code=new JLabel("Code:");
          address=new JLabel("Address:");
          telephone=new JLabel("Telephone:");
          email=new JLabel("E-mail:");
          tname=new JTextField();
          tcode=new JTextField();
          taddress=new JTextArea(4,20);
          ttelephone=new JTextField();
          temail=new JTextField();
          save=new JButton("SAVE");
          exit=new JButton("EXIT");
          //settingBounds
          name.setBounds(10,50,70,25);
          tname.setBounds(90,50,150,25);
          code.setBounds(300,50,70,25);
          tcode.setBounds(380,50,150,25);
          address.setBounds(10,100,70,25);
          taddress.setBounds(90,100,150,75);
          taddress.setBorder(BorderFactory.createLineBorder(Color.BLACK));
          telephone.setBounds(300,100,70,25);
          ttelephone.setBounds(380,100,150,25);
          email.setBounds(10,225,70,25);
          temail.setBounds(90,225,150,25);
          save.setBounds(900,425,100,25);
          exit.setBounds(1000,425,100,25);
          //adding on frame
          add(name);
          add(tname);
          add(code);
          add(tcode);
          add(address);
          add(taddress);
          add(telephone);
          add(ttelephone);
          add(email);
          add(temail);
          add(save);
          add(exit);
  
          //ActionListener
          save.addActionListener(new ActionListener(){
              @Override
              public void actionPerformed(ActionEvent ae){
              //getting data from user
              String demail,checkdemail;  
              int dcode,dtelephone;
              String dname=tname.getText();
              String daddress=taddress.getText();
              checkdemail=temail.getText();
              demail=validateEmail(checkdemail);
              try{
              String stelephone=ttelephone.getText();
              dtelephone=Integer.parseInt(stelephone);
              String scode=tcode.getText();
              dcode=Integer.parseInt(scode);
              addData(dname,dcode,daddress,dtelephone,demail);
              }catch(Exception e){
                  e.printStackTrace();
              }           
              dispose();
              new CustomerMaster();
              }
          });
          exit.addActionListener(new ActionListener(){
              @Override
              public void actionPerformed(ActionEvent ae){
                  dispose();
                  new CustomerMaster();
              }
          });
      }
      public void addData(String name,int code,String address,int telephone,String email){
          Connection con;
          String str;
          PreparedStatement ps;
  
          try{
              Class.forName("oracle.jdbc.driver.OracleDriver");
              con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","PROJECT","PROJECT");
              str="insert into CUSTOMERMASTER values(?,?,?,?,?)";
              ps=con.prepareStatement(str);
              ps.executeUpdate();
              ps.setString(1,name);
              ps.setInt(2,code);
              ps.setString(3,address);
              ps.setInt(4,telephone);
              ps.setString(5,email);
              con.close();
          }catch(Exception e){
              e.printStackTrace();
          }
          }
      private String validateEmail(String email){
          String vemail=null;
          Pattern p1=Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"+"[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
          Matcher m1=p1.matcher(email);
          Boolean b=m1.matches();
          boolean cb=b;
          if(email.equals("")){
              vemail=email;
          }           
          else{
              if(b==true){
                  vemail=email;
              }
              else{
                  Object message="Enter Valid Email.";
                  JOptionPane.showMessageDialog(null,message);
              }
          }
          return vemail;
      }
  }
  </code></pre>
  
  <p>Here is the code for database which is generated by SQL Developer
  code:</p>
  
  <pre><code>CREATE TABLE CUSTOMERMASTER 
  (
    NAME VARCHAR2(20 BYTE) NOT NULL 
  , CODE NUMBER NOT NULL 
  , ADDRESS VARCHAR2(50 BYTE) 
  , TELEPHONE NUMBER 
  , EMAIL VARCHAR2(20 BYTE) 
  ) 
  LOGGING 
  TABLESPACE SYSTEM 
  PCTFREE 10 
  PCTUSED 40 
  INITRANS 1 
  STORAGE 
  ( 
    INITIAL 65536 
    NEXT 1048576 
    MINEXTENTS 1 
    MAXEXTENTS UNLIMITED 
    FREELISTS 1 
    FREELIST GROUPS 1 
    BUFFER_POOL DEFAULT 
  ) 
  NOPARALLEL;
  
  ALTER TABLE CUSTOMERMASTER
  ADD CONSTRAINT CUSTOMERMASTER_UK1 UNIQUE 
  (
    TELEPHONE 
  , EMAIL 
  )
  USING INDEX 
  (
      CREATE UNIQUE INDEX CUSTOMERMASTER_UK1 ON CUSTOMERMASTER (TELEPHONE ASC, EMAIL ASC) 
      LOGGING 
      TABLESPACE SYSTEM 
      PCTFREE 10 
      INITRANS 2 
      STORAGE 
      ( 
        INITIAL 65536 
        NEXT 1048576 
        MINEXTENTS 1 
        MAXEXTENTS UNLIMITED 
        FREELISTS 1 
        FREELIST GROUPS 1 
        BUFFER_POOL DEFAULT 
      ) 
      NOPARALLEL 
  )
   ENABLE;
  </code></pre>