Java Reference
In-Depth Information
L ISTING 7.2
Continued
statement.executeUpdate(“INSERT INTO Titles “ +
“VALUES (2, 'So I Married An Axe Murderer', “ +
“'PG', 19.95, 15, 1, 1)”);
statement.executeUpdate(“INSERT INTO Titles “ +
“VALUES (3, 'Happy Gilmore', “ +
“'PG', 19.95, 9, 1, 1)”);
statement.executeUpdate(“INSERT INTO Titles “ +
“VALUES (4, 'High Plains Drifter', “ +
“'PG', 29.95, 10, 2, 3)”);
statement.executeUpdate(“INSERT INTO Titles “ +
“VALUES (5, 'Cape Fear', “ +
“'NR', 6.99, 21, 0, 5)”);
statement.executeUpdate(“INSERT INTO Titles “ +
“VALUES (6, 'The Last Emperor', “ +
“'PG', 19.95, 12, 1, 2)”);
}
catch (SQLException sqle) {
System.err.println(sqle.getMessage());
}
catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
}
catch (Exception e) {
System.err.println(e.getMessage());
}
finally {
try {
if ( con != null ) {
// Close the connection no matter what
con.close();
}
}
catch (SQLException sqle) {
Search WWH ::




Custom Search