Jasper reports
mrzliJun 7 2006 — edited Jul 6 2007Hi all,
I'm trying to use Jasper reports for creating PDF reports from APEX. I managed to load up jasperreports.jar into database using loadjava utility, created java source :
public class test_jasper {
public static oracle.sql.BLOB test_generate(Integer pnu_id, oracle.sql.BLOB xml_templ) {
try
{
oracle.sql.BLOB lob = null;
InputStream istream = xml_templ.getBinaryStream();
lob = SqljStuff.getEmptyBlob();
OutputStream ostream = lob.getBinaryOutputStream();
Map parameters = new HashMap();
parameters.put("i_pnu_id", pnu_id);
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = new OracleDriver().defaultConnection();
JasperReport jr = JasperCompileManager.compileReport(istream); // error
JasperPrint jprn = JasperFillManager.fillReport(jr, parameters, con);
...
catch (JRException e)
{
System.err.println(e.getMessage());
System.exit(1);
}
catch (Exception e)
{
System.err.println(e.getMessage());
System.exit(1);
}
and pl/sql function for calling this java:
FUNCTION TEST_PDF (ORIG_ID IN NUMBER, XML_TEMPL IN BLOB)
RETURN BLOB AS language java name
'test_jasper.test_generate(java.lang.Integer, oracle.sql.BLOB) return oracle.sql.BLOB';
but when I try to call this pl/sql function it crashes (exit called from java code with status 1). How do I get more info what might cause the error (can JasperReports work in database at all)?
I tried to run same source from JDeveloper as standalone java app. and it works.
Thanks in advance,
Mrzli.