Pessoal,
Tenho esse código e não ta funfando:
public class Gerar {
/*
private static Connection getConnection( ) throws ClassNotFoundException, SQLException {
String driver = "org.firebirdsql.jdbc.FBDriver";
String url = "jdbc:firebirdsql:localhost/3050:c://db//Acervo.FDB";
String user = "sysdba";
String password = "masterkey";
Class.forName(driver);
Connection con = DriverManager.getConnection( url, user, password );
return con;
}
*/
public void geraRelatorio( ) throws JRException, Exception {
// Connection con = getConnection( );
// Statement stm = con.createStatement( );
// String query = "select * from Livro";
// ResultSet rs = stm.executeQuery( query );
/* implementação da interface JRDataSource para DataSource ResultSet */
// JRResultSetDataSource jrRS = new JRResultSetDataSource( rs );
/* HashMap de parametros utilizados no relatório. Sempre instanciados */
Map parameters = new HashMap();
parameters.put("CAMPO1", "nome");
parameters.put("CAMPO2", new Date());
Connection jrRS = null;
/* Preenche o relatório com os dados. Gera o arquivo BibliotecaPessoal.jrprint */
JasperFillManager.fillReportToFile( "RelatorioTeste.jasper", parameters, jrRS );
/* Exporta para o formato PDF */
JasperExportManager.exportReportToPdfFile( "RelatorioTeste.jrprint" );
/* Preenche o relatorio e o salva diretamente em arquivo PDF. Sem a necessidade do .jrprint */
//JasperRunManager.runReportToPdfFile("RelatorioTeste.jasper", parameters, jrRS);
/* Visualiza o relatório em formato PDF */
JasperViewer.viewReport( "RelatorioTeste.pdf", true );
System.out.println("ok");
}
public static void main(String[] args) throws JRException, Exception {
new Gerar().geraRelatorio();
}
}
Msg de erro: