title: Using JButtons to execute SQL queries with JDBC
body: <p>I'm writing a simple JAVA GUI to read an SQL query from a JTextFrame and execute it.  </p>
  
  <p>The connect and execute buttons are both JButtons, but the compiler won't compile my code because I can't append a "throws SQLException" to actionPerformed in my Listener private classes.  I tried writing separate methods, but the same problem still persists.  Here's an example: </p>
  
  <pre><code>public void connect() throws SQLException {
      conxn = DriverManager.getConnection(URL, Username, Password);
  }
  private class SelectBut implements ActionListener {  
      public void actionPerformed(ActionEvent event){
          connect();
      }
  }
  </code></pre>
  
  <p>The compiler just throws this back at me: </p>
  
  <pre><code>TextFrame.java:123: unreported exception java.sql.SQLException; must be caught or declared to be thrown  
  public void actionPerformed(ActionEvent event){connect();}}
  </code></pre>
  
  <p>Any suggestions?</p>