title: How to loop a prepared statement to a derby database from spreadsheet line items
body: <p>Is there a way to enter recurring data into a set database fields while using the prepared statement (pst)? I’m using the Derby DB. </p>
  
  <p>I have an Excel spreadsheet that I get data from. Each line has 5 entry fields: Line item description, cost, quantity, extended cost, and price. I want to enter that into the derby db using just the five entries but with multiple lines each having five entries off the spreadsheet. The database has the following fields: 
      MATLINEITEM     varchar 200
      MATLINEITEMCOST     varchar 7
      MATLINEITEMQTY  varchar 7
      MATLINEITEMXCOST    varchar 7
      MATLINEITEMPRICE    varchar 7</p>
  
  <p>Using the standard INSERT with “ ?” approach, I would need to have an entry for each line and each spreadsheet field. If I have 10 lines, then I would need 50 “prepared statement” lines. I want to just use a loop to read each line and the five entries assigned to that line and enter it into the database. </p>
  
  <p>The data from the spreadsheet is first converted to String (using POI) and assigned to a TextField. </p>
  
  <pre><code>addSQL = "INSERT INTO MATERIALTBL (MATLINEITEM, MATLINEITEMCOST, 
     MATLINEITEMQTY, MATLINEITEMXCOST, MATLINEITEMPRICE) VALUES (?,?,?,?,?) ";
  
     pst = conn.prepareStatement(addSQL);
  
    pst.setString(1,jtxtfld_Item.getText());
    pst.setString(2,jtxtfld_Cost.getText());
    pst.setString(3,jtxtfld_Qty.getText());
    pst.setString(4,jtxtfld_XCost.getText());
    pst.setString(5,jtxtfld_Price.getText());
  
    pst.executeUpdate();
  </code></pre>
  
  <p>Any help would be appreciated. Or point me in the right direction as to what I can be using to get this result. Thank you. </p>