Java Reference
In-Depth Information
L ISTING 7.2
Continued
// Create the statement
Statement statement = con.createStatement();
// Use the created statement to INSERT DATA into
// the database tables.
// Insert Data into the Types Table
statement.executeUpdate(“INSERT INTO Types “ +
“VALUES (0, 'VHS')”);
7
statement.executeUpdate(“INSERT INTO Types “ +
“VALUES (1, 'DVD')”);
statement.executeUpdate(“INSERT INTO Types “ +
“VALUES (2, 'Laserdisc')”);
// Insert Data into the Categories Table
statement.executeUpdate(“INSERT INTO Categories “ +
“VALUES (0, 'Action Adventure')”);
statement.executeUpdate(“INSERT INTO Categories “ +
“VALUES (1, 'Comedy')”);
statement.executeUpdate(“INSERT INTO Categories “ +
“VALUES (2, 'Drama')”);
statement.executeUpdate(“INSERT INTO Categories “ +
“VALUES (3, 'Western')”);
statement.executeUpdate(“INSERT INTO Categories “ +
“VALUES (4, 'Sci-Fi')”);
statement.executeUpdate(“INSERT INTO Categories “ +
“VALUES (5, 'Classics')”);
// Insert Data into the Titles Table
statement.executeUpdate(“INSERT INTO Titles “ +
“VALUES (0, 'The Adventures of Buckaroo Banzai', “ +
“'PG', 19.95, 10, 0, 4)”);
statement.executeUpdate(“INSERT INTO Titles “ +
“VALUES (1, 'Saving Private Ryan', “ +
“'R', 19.95, 12, 1, 0)”);
 
Search WWH ::




Custom Search