The updateAction( ) method
// A method that updates a certain row of the 'xmp' table.
// This method illustrates prepared statements and parameter markers.
public static String updateAction(Connection con)
throws Exception {
String sql = "update xmp set name = ?, home = ? where id = ?";
int id=1;
Address home = new Address("123 Main", "98765");
String name = "Sam Brown";
PreparedStatement pstmt = con.prepareStatement(sql);
pstmt.setString(1, name);
pstmt.setObject(2, home);
pstmt.setInt(3, id);
int res = pstmt.executeUpdate();
return "performed";
}