title: How to connect JasperRerport to print certain data from Postgress db in netbeans
body: <p>I am trying to generate some reports using JasperReports
  this is what I've done so far.</p>
  
  <pre><code>    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
  
      Connection conn = null;
  
      try{
  
          Class.forName("org.postgresql.postgresql-42.2.2");
          conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test", "postgres", "testPassword");
          String report = "";
  
          JasperReport jasperReport = JasperCompileManager.compileReport(report);
  
          JasperPrint jp = JasperFillManager.fillReport(jasperReport, null, conn);
  
          JasperExportManager.exportReportToPdfStream(jp, response.getOutputStream());
          response.getOutputStream().flush();
          response.getOutputStream().close();
  
      }catch(Exception ex){
          System.out.println(ex);
      }
  }                                        
  </code></pre>
  
  <p>I did all this with the help of this <a href="https://www.youtube.com/watch?v=rTuWRdOKYtU&amp;app=desktop" rel="nofollow noreferrer">video</a></p>
  
  <p>But the "response.getOutputStream()" doesnt work.
  it wont find the response variable. (the tutorial is made in eclipse so thought that is the cause ,or netbeans wont be able to find it..</p>
  
  <p>What can be the solution for this?
  do you have any other way how to do it?</p>