title: To write the value from resultset to text file (.txt file)
body: <p>Please help me on the below code as i want to write the values from the resultset to a txt file</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>while (rs.next()){
      FileWriter fstream = new FileWriter(file);
      BufferedWriter out = new BufferedWriter(fstream);
  
      out.write(Integer.toString(rs.getInt("SBL_PRODUCT_ID")) + ", ");
      out.write(Integer.toString(rs.getInt("SBL_TARIFF_ID")) + ", ");
      out.write(rs.getString("PRODUCT_DESCRIPTION") + ", ");
      out.write(rs.getString("SERVICE_TYPE") + ", ");
      out.write(Integer.toString(rs.getInt("MARKET_CLASS")) + ", ");
      out.write(rs.getString("ENTITY_TYPE") + ", ");
      out.newLine();
      /*out.write(System.getProperty("line.separator"));*/
  
      System.out.println("Completed writing into text file");
      out.close();
  }
  </code></pre>
  
  <p><strong>Required Output in the txt file</strong></p>
  
  <pre><code>4087, 98, POSTE SIM, Deal [SoHo Flat Tariff Recurring Charge, Prepaid], /service/telco/SIM, 101, DEAL
  
  4087, 99, POSTE SIM, Deal [SoHo Flat Tariff Recurring Charge, Prepaid], /service/telco/SIM, 101, DEAL
  
  4087, 100, POSTE SIM, Deal [SoHo Flat Tariff Recurring Charge, Prepaid], /service/telco/SIM, 101, DEAL
  
  4087, 101, POSTE SIM, Deal [SoHo Flat Tariff Recurring Charge, Prepaid], /service/telco/SIM, 101, DEAL
  </code></pre>
  
  <p>Current output which i am getting is only one line that too the last value from the resultset ie below</p>
  
  <p><strong>Current output</strong></p>
  
  <pre><code>4087, 101, POSTE SIM, Deal [SoHo Flat Tariff Recurring Charge, Prepaid], /service/telco/SIM, 101, DEAL
  </code></pre>
  
  <p>Kindly help me on this :(</p>