Java Reference
In-Depth Information
}
con.close();
}
catch(SQLException e){
reportException(e.getMessage());
}
return dataTypes;
}
public void setExceptionListener(ActionListener exceptionListener){
this.exceptionListener=exceptionListener;
}
private void reportException(String exception){
if(exceptionListener!=null){
ActionEvent evt = new ActionEvent(this,0,exception);
exceptionListener.actionPerformed(evt);
}else{
System.err.println(exception);
}
}
}
Summary
In this chapter
, you learned about:
Using
SQL INSERT
to populate a table
Using
SQL
UPDATE
to modify the contents of a table
Using
SQL
DELETE
to delete records from a table
Using the
SELECT
clause and how to use it with
INSERT
Using the
WHERE
clause and how to use it with
UPDATE
and
DELETE
Applying the basics of transaction control with
COMMIT
and
ROLLBACK
Using JDBC
ResultSetMetaData
to get information about a table
Using JDBC and Swing to create a JDBC/SQL table editor
Chapter 7
discusses retrieving data from a database by using the
SELECT
command.