title: how to load data from database to excel sheet
body: <p>I need to load data from database to excel sheet. so when I run the code throw this exception.
  This is what i am working with so far.
  database table name is pettycash so I need  to load data from this table.</p>
  
  <pre><code>private void excelTest(ActionEvent event) {
      try {
          String cococo = "select * from pettycash";
          ResultSet rs = database.DB_Connector.search(cococo);
  
          XSSFWorkbook wb = new XSSFWorkbook();
          XSSFSheet sheet = wb.createSheet("pettycash");
          XSSFRow Header = sheet.createRow(0);
          Header.createCell(0).setCellValue("Petty ID");
          Header.createCell(1).setCellValue("pettycash_static_ammount");
          Header.createCell(2).setCellValue("pettycash_balance");
          Header.createCell(3).setCellValue("pettygiv_Date");
          Header.createCell(4).setCellValue("pettycash_status");
          Header.createCell(5).setCellValue("Rider_idRider");
  
          int index = 1;
          while (rs.next()) {
  
              XSSFRow row = sheet.createRow(index);
              row.createCell(0).setCellValue(rs.getString("idpettycash"));
              row.createCell(1).setCellValue(rs.getString("pettycash_static_ammount"));
              row.createCell(2).setCellValue(rs.getString("pettycash_balance"));
              row.createCell(3).setCellValue(rs.getString("pettygiv_Date"));
              row.createCell(4).setCellValue(rs.getString("pettycash_status"));
              row.createCell(5).setCellValue(rs.getString("Rider_idRider"));
              index++;
  
          }
  
          FileOutputStream fileout = new FileOutputStream("petycash.xlsx");
          wb.write(fileout);
          fileout.close();
  
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>