Retrieving Information from the Database: Backorders

Now that we have the information in the database, let's look at how to get it out again. To do this, we're going to look at our backorders—products for which we have a negative number on hand.

In Listing 8.23, we'll select a set of records and output them to the screen.

Listing 8.23. ParseOrders.java: Selecting Records
...
139:                 String thisValue = (String)products.get(thisKey);
140:
141:                 update(thisProduct, thisColor, thisValue);
142:
143:             }
144:
145:         } catch (Exception e) {
146:             System.out.println("Problem updating the database.");
147:             return;
148:         }
149:
150:     }
151:
152:     public void showBackorders() {
					153:
					154:         String sqlTxt = "select product_id, color, inv from "+
					155: "inventory where ...

Get XML and Java™ from scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.