我希望ro显示来自java的报告,其中包含来自数据库的照片blob,但它会返回此异常
在位置找不到字节数据:java.io.ByteArrayInputStream@6b9ea0a7
但如果我删除照片,报告会正常显示,或者我更改了图片的属性“On error to blank” 这是java代码
public void genere(){
try{
String xmlFile = "D:\\1-LICENCE\\Logiciel\\MAGAZINE\\magazine\\mag.jrxml";
String jasperFile = "D:\\1-LICENCE\\Logiciel\\MAGAZINE\\magazine\\magazine.jasper";
String pdfFile = "D:\\1-LICENCE\\Logiciel\\MAGAZINE\\magazine\\magazine.pdf";
JasperDesign jasperDesign = JRXmlLoader
.load(xmlFile);
String sql = "SELECT "
+ "article.n_article AS article_n_article,article.titre AS article_titre,"
+ "article.article AS article_article,article.image AS article_image,"
+ "article.code_domaine_domaine AS article_code_domaine_domaine,"
+ "article.num_mag_magazine AS article_num_mag_magazine,"
+ "article.matricule_auteur AS article_matricule_auteur,"
+ "auteur.matricule AS auteur_matricule,auteur.nom AS auteur_nom,"
+ "domaine.code_domaine AS domaine_code_domaine,domaine.nom_domaine AS domaine_nom_domaine,"
+ "magazine.num_mag AS magazine_num_mag,magazine.date_mag AS magazine_date_mag"
+ " FROM article "
+ "INNER JOIN auteur ON article.matricule_auteur=auteur.matricule "
+ "INNER JOIN domaine ON article.code_domaine_domaine=domaine.code_domaine "
+ "INNER JOIN magazine ON article.num_mag_magazine=magazine.num_mag WHERE num_mag_magazine='"
+ cmbMag.getSelectedItem().toString()+"'";
JRDesignQuery newQuery = new JRDesignQuery();
newQuery.setText(sql);
jasperDesign.setQuery(newQuery);
JasperReport report = JasperCompileManager
.compileReport(jasperDesign);
JasperPrint print = JasperFillManager.fillReport(report, null, cnx);
JasperViewer.viewReport(print,false);
//JasperExportManager.exportReportToPdfFile(print, pdfFile);
}catch(Exception e){
Logger.getLogger(Generator.class.getName()).log(Level.SEVERE, null, e);
}
}