Figure 5


Skeleton code to access a database through JDBC.

java.sql.Statement stmt = conn.createStatement();

// Assume we have a product table named TABLEproduct
ResultSet records = stmt.executeQuery("SELECT p FROM TABLEproduct");
while ( records.next()) {
     ...   // get one product at a time until the result set empty. 
}