Guest User

Untitled

a guest
Apr 11th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. try {
  2. Class.forName("com.mysql.jdbc.Driver");
  3. Connection conexion;
  4. conexion = DriverManager.getConnection("jdbc:mysql://EJEMPLO/DBEJEMPLO?zeroDateTimeBehavior=convertToNull", "root", "SistemasDaca");
  5.  
  6.  
  7. JasperReport reporte = null;
  8. String path = "src\reportes\derechohabiente.jasper";
  9. //CARGO EL REPORTE AL OBJETO
  10. reporte = (JasperReport) JRLoader.loadObjectFromFile(path);
  11. // LLENANDO EL REPORTE
  12. JasperPrint jprint = JasperFillManager.fillReport(reporte, null,conexion);
  13. // CREAMOS LA VISTA DEL REPORTE
  14. JasperViewer view = new JasperViewer(jprint,false);
  15. // LE AGREGAMOS QUE SE CIERRE SOLO EL REPORTE
  16. view.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  17. // INICIALIZAMMOS LA VISTA DEL REPORTE
  18. view.setVisible(true);
  19. } catch (Exception ex) {
  20. Logger.getLogger(frmPrincipal.class.getName()).log(Level.SEVERE, null, ex);
  21. }
Add Comment
Please, Sign In to add comment