Chapter 15 622 Here, we make a connection to the RDBMS: databaseBean myQuery = new databaseBean(); public void startDocument () {   try {     myQuery.makeConnection();   } catch (Exception e) { e.printStackTrace(); } } The general parsing strategy here is to collect all the fields and attributes of a trip record, and then at the endElement() of the <trip> element, we add a record to the RDBMS representing the trip.   public void endElement (String name) {     if (name.compareTo("startdate")==0)  {       lastParsedStart = lastParsedText;     }     if (name.compareTo("duration")==0) {       lastParsedDur = lastParsedText;     }     if (name.compareTo("location")==0) {       lastParsedLoc = lastParsedText;     }     if (name.compareTo("price")==0) {       lastParsedPri = lastParsedText;     }     if (name.compareTo("commission")==0) {       lastParsedCom = lastParsedText;     }     if (name.compareTo("region")==0) {       lastParsedRegion = lastParsedText;     }     if (name.compareTo("trip")==0) {       try {         myQuery.addTrip(lastParsedStart,                         lastParsedRegion,                         lastParsedDur,                         lastParsedLoc,                         lastParsedPri,                         lastParsedCom);       } catch (Exception e) { e.printStackTrace(); }     }   } endDocument() is an opportune time for taking down the RDBMS connection:   public void endDocument() {     try {       myQuery.takeDown();     } catch (Exception e) { e.printStackTrace(); }   } }