How to do with SQLException in below code?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
class test extends JFrame throws SQLException {
JButton jbt;
public static void main(String[] args){
new test();
}
public void test(){
setTitle("Demo");
jbt = new JButton("Open SQL");
Container c = this.getContentPane();
c.setLayout(new BorderLayout());
c.add(jbt,BorderLayout.CENTER);
jbt.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:guihua";
Connection con = DriverManager.getConnection(url, "", "");
Statement s = con.createStatement();
String query = "select * from certificateList)";
s.execute(query);
con.close();
}
catch(SQLException e){
System.err.println(e.getMessage());
}
}
});
addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent e){
System.exit(0);
}
});
pack();
setVisible(true);
}
}
error info happened as below
test.java:9: '{' expected
public class test extends JFrame throws SQLException {
^
test.java:52: '}' expected
}
^
2 errors
waiting for your help!!!!!!!!!!!!!!!!!!!!!!

