title: Java -- Exception must be thrown, but how?
body: <p>I am getting an error in  NetBeans saying I must throw an SQLException in this method:</p>
  
  <pre><code>private void displayCustomerInfo(java.awt.event.ActionEvent evt)                                     
  {                                         
      int custID = Integer.parseInt(customerID.getText());
      String info = getCustomerInfo(custID);
      results.setText(info);
  }
  </code></pre>
  
  <p>This method is created by NetBeans so it is not allowing me to edit the signature and throw the exception. This is why I created the <code>getCustomerInfo()</code> method. This method does throw the exception, because it uses a method to retrieve information from a database about a customer.</p>
  
  <pre><code>public String getCustomerInfo(int cid) throws SQLException
  {
      Customer c = proc.getCustomer(cid);
      // get info
      return "info";
  }
  </code></pre>
  
  <p>The <code>getCustomer</code> method also throws the exception and proc.java compiles.</p>
  
  <p>The exact error is </p>
  
  <pre><code>unreported exception java.sql.SQLException; must be caught or declared to be thrown
  </code></pre>