How to send a report to call with iReport

0

Hello, I created a report with ireport and jsperReport and I used this code:

String path = "C:\Users\Juan\Documents\NetBeansProjects\Archivero\src\Reportes\Pendientes.jrxml";
try {
    JasperReport reporte;
    reporte=(JasperReport)JRLoader.loadObjectFromLocation(path);
    JasperPrint jasperPrint;
    jasperPrint = JasperFillManager.fillReport(path,null,con.ConBD);
    JasperViewer viewer = new JasperViewer(jasperPrint,false);
    viewer.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    viewer.setVisible(true);
} catch (Exception e) {
}

The connection class is the following:

package Clases;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

public class Conexion {

    public Connection ConBD;
    public Statement SentenciaSQL;
    public ResultSet Consulta;
    String url = "src\BaseDatos\doc_sal.db";
    public void Abrir() {
        try {
            Class.forName("org.sqlite.JDBC");
            ConBD = DriverManager.getConnection("jdbc:sqlite:" + url);
        } catch (SQLException ex) {
            System.err.println("No se ha podido conectar a la base de datos\n" + ex.getMessage());
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void close() {
        try {
            ConBD.close();
        } catch (SQLException ex) {
            Logger.getLogger(Conexion.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

Currently it does not work and I would like you to help me solve it or fail me.
Postscript I think it's this line of code:

jasperPrint = JasperFillManager.fillReport(path,null,con.ConBD);

since in the documentation I found it instead of using con.ConBD I only used con.Abrir() .

    
asked by Juan Enrique Feregrino Gomez 04.06.2018 в 20:35
source

0 answers