May 2001
Intermediate to advanced
1088 pages
30h 13m
English
After you know the SQL commands, it's not hard to make database updates. The pattern for performing inserts, updates, and deletions is basically the same. You can either use the Statement or the PreparedStatement interface, depending on whether you want to insert the data into the SQL string or use parameterized data.
Listing 3.2 shows a program that inserts, updates, and then deletes a row. The example uses the original definition of the Person table from Chapter 2, "A Quick Primer on SQL."
package usingj2ee.jdbc; import java.sql.*; public class InsUpdDel { public static void main(String[] args) { try { // Make sure the DriverManager knows about the driver ... |
Read now
Unlock full access