title: From jTextField to INSERT sql
body: <p>I would like to thank you guys in advance for taking the time. I'm trying to insert the values that entered in jtextfield into a table using sql statement but i'm keep getting a bunch of errors.</p>
  
  <p>Listener :    </p>
  
  <pre><code>private void jTextField1FocusLost(java.awt.event.FocusEvent evt) {
      name = jTextField1.getText();
  }                                     
  
  private void jTextField2FocusLost(java.awt.event.FocusEvent evt) {
      username = jTextField2.getText();
  }                                     
  
  private void jTextField3FocusLost(java.awt.event.FocusEvent evt) {
      String pword = jTextField2.getText();
      password = Integer.parseInt(pword);
      //the convertion is essential because the password column in the table is defined as integer
  }                                     
  
  private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
  
      register regis = new register(name, username, password);
      regis.registerUser();
  } 
  </code></pre>
  
  <p>INSERT :</p>
  
  <pre><code>public class register {
  
      public String name;
      public String username;
      public Integer password;
  
      public register(String nm, String uname, Integer passw) {
          name = nm;
          username = uname;
          password = passw;
      }
  
      public void registerUser(){
  
          try { 
              String host = "jdbc:derby://localhost:1527/fypDB";
              String uname = "uname";
              String pword = "123456";
              Connection con = DriverManager.getConnection( host, uname, pword );
              Statement stmt = con.createStatement();
  
              String SQL = "INSERT INTO LOGIN VALUES('"+username+"',"+password+")";
              stmt.executeUpdate( SQL );
          } catch (SQLException err){
              System.out.println(err.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>The LOGIN table has only 2 columns so i just ignored the "name" variable.</p>
  
  <p>Since i cannot upload the image i'll describe the interface. textfield 1 and 2 entered "test13" and 3rd textfield which is for password is entered "10" and then register button was clicked.</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "test13"
  at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
  at java.lang.Integer.parseInt(Integer.java:580)
  at java.lang.Integer.parseInt(Integer.java:615)
  at Interface.Register.jTextField3FocusLost(Register.java:137)
  at Interface.Register.access$200(Register.java:15)
  at Interface.Register$3.focusLost(Register.java:63)
  at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:230)
  at java.awt.Component.processFocusEvent(Component.java:6419)
  at java.awt.Component.processEvent(Component.java:6283)
  at java.awt.Container.processEvent(Container.java:2234)
  at java.awt.Component.dispatchEventImpl(Component.java:4883)
  at java.awt.Container.dispatchEventImpl(Container.java:2292)
  at java.awt.Component.dispatchEvent(Component.java:4705)
  at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)
  at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:995)
  at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:661)
  at java.awt.Component.dispatchEventImpl(Component.java:4754)
  at java.awt.Container.dispatchEventImpl(Container.java:2292)
  at java.awt.Component.dispatchEvent(Component.java:4705)
  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
  at java.awt.EventQueue.access$400(EventQueue.java:97)
  at java.awt.EventQueue$3.run(EventQueue.java:697)
  at java.awt.EventQueue$3.run(EventQueue.java:691)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
  at java.awt.EventQueue$4.run(EventQueue.java:719)
  at java.awt.EventQueue$4.run(EventQueue.java:717)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
  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>