title: How to solve Uncompilable source code - Erroneous sym type: java.sql.Statement.executeUpdate in Netbeans
body: <p>I am doing a simple bus ticket management project. For that purpose i want to add the system user data in the database. But my problem is ,it is showing that the code has an error in the following line in netbeans. </p>
  
  <pre><code> int executedQuery=statement.executeUpdate();
  </code></pre>
  
  <p>If the code is compiled with error then the following error message in  showing </p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: java.sql.Statement.executeUpdate
      at airlinessoft1301d.User_New.add_jButton1ActionPerformed(User_New.java:367)
      at airlinessoft1301d.User_New.access$100(User_New.java:21)
      at airlinessoft1301d.User_New$2.actionPerformed(User_New.java:255)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
      at java.awt.Component.processMouseEvent(Component.java:6535)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
      at java.awt.Component.processEvent(Component.java:6300)
      at java.awt.Container.processEvent(Container.java:2236)
      at java.awt.Component.dispatchEventImpl(Component.java:4891)
      at java.awt.Container.dispatchEventImpl(Container.java:2294)
      at java.awt.Component.dispatchEvent(Component.java:4713)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
      at java.awt.Container.dispatchEventImpl(Container.java:2280)
      at java.awt.Window.dispatchEventImpl(Window.java:2750)
      at java.awt.Component.dispatchEvent(Component.java:4713)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
      at java.awt.EventQueue.access$500(EventQueue.java:97)
      at java.awt.EventQueue$3.run(EventQueue.java:709)
      at java.awt.EventQueue$3.run(EventQueue.java:703)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
      at java.awt.EventQueue$4.run(EventQueue.java:731)
      at java.awt.EventQueue$4.run(EventQueue.java:729)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
  </code></pre>
  
  <p>compiler error output :</p>
  
  <pre><code>warning: [options] bootstrap class path not set in conjunction with -source 1.7
  D:\Farhad_BusTicketManagement\src\airlinessoft1301d\User_New.java:369: error: no suitable method found for executeUpdate(no arguments)
            int executedQuery=statement.executeUpdate();
      method Statement.executeUpdate(String) is not applicable
        (actual and formal argument lists differ in length)
      method Statement.executeUpdate(String,int) is not applicable
        (actual and formal argument lists differ in length)
      method Statement.executeUpdate(String,int[]) is not applicable
        (actual and formal argument lists differ in length)
      method Statement.executeUpdate(String,String[]) is not applicable
        (actual and formal argument lists differ in length)
  Note: D:\Farhad_BusTicketManagement\src\airlinessoft1301d\User_New.java uses or overrides a deprecated API.
  Note: Recompile with -Xlint:deprecation for details.
  1 error
  1 warning
  D:\Farhad_BusTicketManagement\nbproject\build-impl.xml:946: The following error occurred while executing this line:
  D:\Farhad_BusTicketManagement\nbproject\build-impl.xml:263: Compile failed; see the compiler error output for details.
  BUILD FAILED (total time: 0 seconds)
  </code></pre>
  
  <p>The entire source code has given below. Though i have done some other database insert work in the same manner and they worked. Please anyone tell me where i have made the mistake.</p>
  
  <p>I am using Netbeans GUI builder to create the user interface.
  Netbeans version is 8.1
  jdk 1.8_60.</p>
  
  <p>Previously i was using netBeans 7.3. In the internet saw that netBean 7 has a bug that it may show such error. Then i have installed netbeans 8.1. but the problem is same.</p>
  
  <p>Computer generated code has not given.</p>
  
  <pre><code>    import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.PreparedStatement;
      import java.sql.SQLException;
      import java.sql.Statement;
      import java.util.logging.Level;
      import java.util.logging.Logger;
      import javax.swing.JOptionPane;
  
      /**
       *
       * @author Cybertrons
       */
  
      public class User_New extends javax.swing.JFrame {
  
  
          public User_New()
          {
              initComponents();
          }
  
  
      //start of loadingDriver(). This method will be called where driver loading is needed.
          public void loadingDriver()
          {
              try
              {
                      Class.forName("com.mysql.jdbc.Driver");
              }
              catch (ClassNotFoundException ex)
              {
                      Logger.getLogger(User.class.getName()).log(Level.SEVERE, null, ex);
              }
          }
      //End of loadingDriver(). This method will be called where driver loading is needed
  
   @SuppressWarnings("unchecked")//computer generated code not given.
  
   private void name_jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {                                                 
          // TODO add your handling code here:
      }                                                
  
      private void add_jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                             
          // TODO add your handling code here:
  
          //Just for checking that add button is working.
          JOptionPane.showMessageDialog(rootPane,"Clicked...!");
  
   //   Start of Varriable Decaliration.
          String userID;
          String name;
          String birthDate;
          String phone;
          String email;
          String gender;
          String userName;
          String password;
          String position;
  //   End of Varriable Decaliration.     
  
  //  Strat of Reading vlaue form text fields.
          userID      =userId_jTextField1.getText();
          name        =name_jTextField1.getText();
          birthDate   =birth_Date_jTextField2.getText();
          phone       =phone_jTextField3.getText();
          email       =email_jTextField4.getText();
          gender      =Gender_jComboBox1.getSelectedItem().toString();
          userName    =userName_jTextField5.getText();
          password    =pass_word_jPasswordField1.getText().toString();
          position    =position_jTextField7.getText();
  //  End of Reading vlaue form text fields.
  
          Connection connection   = null;
          Statement  statement    = null; 
  
  //The driver will loaded here by calling the method loadingDriver(), That has defined above.
          loadingDriver();
  
  // start of inserting data into database.
          try //inseritng try block.
          {
  //            connecting to databse.
              connection = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/busticket", "root", "");            
  //            Insering to database.
              statement = (PreparedStatement) 
                      connection.prepareStatement("insert into newuser (userID,name,birthDate,phone,email,gender,userName,password,position) values"
                    + "(NULL ,'"+userID+"','"+name+"','"+birthDate+"','"+phone+"','"+email+"','"+gender+"','"+userName+"',"
                      + " '"+password+"','"+position+"')");
  
              //To ensure that the query has executed successfully.
            int executedQuery=statement.executeUpdate();
  
  //  Start of making the text fields Empty
              if(executedQuery==1)
              {
                  JOptionPane.showMessageDialog(rootPane, "Inserted Success fully....!");
                //start of setting emplty string at the text fields.
                     userId_jTextField1.setText("");
                     name_jTextField1.setText("");
                     birth_Date_jTextField2.setText("");
                     phone_jTextField3.setText("");
                     email_jTextField4.setText("");
                     userName_jTextField5.setText("");
                     pass_word_jPasswordField1.setText("");
                     position_jTextField7.setText("");
              //end of setting emplty string at the text fields.
              }
  //  End of making the text fields Empty
  
  //      Start of  Closing Databae Connection.
              if(statement!=null)
              {
                  statement.close();
              }
              if(connection!=null)
              {
                  connection.close();
              }
  //      end of      Closing Databae Connection.
  
          }
          catch(SQLException ex)
          {
              Logger.getLogger(Home.class.getName()).log(Level.SEVERE, null, ex);
          }
  // end of inserting data into database.
      }                                            
  
  
      public static void main(String args[]) {
          /* Set the Nimbus look and feel */
          //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt;
          /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
           */
          try {
              for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      javax.swing.UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (ClassNotFoundException ex) {
              java.util.logging.Logger.getLogger(User_New.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(User_New.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(User_New.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(User_New.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
          //&lt;/editor-fold&gt;
  
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new User_New().setVisible(true);
              }
          });
      }
  </code></pre>