jdbc - Java Connection String - Embedding pentaho Report Engine in Java Aplication -
i'm having difficulty connecting db2 database in java application. have found examples online have been unable apply them being new java. attempt below. program extracts data database within datafactory method produces html report.
package org.pentaho.reporting.engine.classic.samples; import java.io.file; import java.io.ioexception; import java.util.map; import org.pentaho.reporting.engine.classic.core.datafactory; import org.pentaho.reporting.engine.classic.core.masterreport; import org.pentaho.reporting.engine.classic.core.reportprocessingexception; import org.pentaho.reporting.engine.classic.core.pagedefinition; import org.pentaho.reporting.engine.classic.core.wizard.relationalautogeneratorpreprocessor; import org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.sqlreportdatafactory; import org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.driverconnectionprovider; public class report2013html extends abstractreportgenerator { private static final string query_name = "reportquery"; /** * default constructor sample report generator */ public report2013html() { } * @return loaded , parsed report definition used in report generation. */ public masterreport getreportdefinition() { final masterreport report = new masterreport(); report.setquery(query_name); report.addpreprocessor(new relationalautogeneratorpreprocessor()); return report; } public datafactory getdatafactory() { final driverconnectionprovider sampledriverconnectionprovider = new driverconnectionprovider(); sampledriverconnectionprovider.setdriver("com.ibm.db2.jcc.db2driver"); sampledriverconnectionprovider.seturl("jdbc:db2://hostname:1000/database"); sampledriverconnectionprovider.setproperty("user", "user"); sampledriverconnectionprovider.setproperty("password", "pass"); final sqlreportdatafactory datafactory = new sqlreportdatafactory(sampledriverconnectionprovider); datafactory.setquery(query_name, "select project_name fact_table"); return datafactory; }
after there 1 last method produces html file. i'm getting report processed failed error among connectivity errors obviously.
exception in thread "main" org.pentaho.reporting.engine.classic.core.reportprocessingexception: unable initialize report @ org.pentaho.reporting.engine.classic.core.layout.output.abstractreportprocessor.preparereportprocessing(abstractreportprocessor.java:563) @ org.pentaho.reporting.engine.classic.core.layout.output.abstractreportprocessor.processreport(abstractreportprocessor.java:1412) @ org.pentaho.reporting.engine.classic.samples.abstractreportgenerator.generatereport(abstractreportgenerator.java:218) @ org.pentaho.reporting.engine.classic.samples.abstractreportgenerator.generatereport(abstractreportgenerator.java:128) @ org.pentaho.reporting.engine.classic.samples.mira2013html.main(mira2013html.java:103) parentexception: org.pentaho.reporting.engine.classic.core.reportdatafactoryexception: failed @ query: select project_name fact_table @ org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.simplesqlreportdatafactory.querydata(simplesqlreportdatafactory.java:270) @ org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.sqlreportdatafactory.querydata(sqlreportdatafactory.java:95) @ org.pentaho.reporting.engine.classic.core.states.cachingdatafactory.queryinternal(cachingdatafactory.java:176) @ org.pentaho.reporting.engine.classic.core.states.cachingdatafactory.querydata(cachingdatafactory.java:144) @ org.pentaho.reporting.engine.classic.core.states.cascadingdatafactory.querydata(cascadingdatafactory.java:110) @ org.pentaho.reporting.engine.classic.core.states.datarow.reportdatarow.createdatarow(reportdatarow.java:97) @ org.pentaho.reporting.engine.classic.core.states.datarow.defaultflowcontroller.performquery(defaultflowcontroller.java:189) @ org.pentaho.reporting.engine.classic.core.states.process.processstate.<init>(processstate.java:279) @ org.pentaho.reporting.engine.classic.core.layout.output.abstractreportprocessor.preparereportprocessing(abstractreportprocessor.java:463) @ org.pentaho.reporting.engine.classic.core.layout.output.abstractreportprocessor.processreport(abstractreportprocessor.java:1412) @ org.pentaho.reporting.engine.classic.samples.abstractreportgenerator.generatereport(abstractreportgenerator.java:218) @ org.pentaho.reporting.engine.classic.samples.abstractreportgenerator.generatereport(abstractreportgenerator.java:128) @ org.pentaho.reporting.engine.classic.samples.report2013html.main(report2013html.java:103) parentexception: java.sql.sqlexception: unable load driver: com.ibm.db2.jcc.db2driver @ org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.driverconnectionprovider.createconnection(driverconnectionprovider.java:102) @ org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.simplesqlreportdatafactory.getconnection(simplesqlreportdatafactory.java:184) @ org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.simplesqlreportdatafactory.querydata(simplesqlreportdatafactory.java:255) @ org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.sqlreportdatafactory.querydata(sqlreportdatafactory.java:95) @ org.pentaho.reporting.engine.classic.core.states.cachingdatafactory.queryinternal(cachingdatafactory.java:176) @ org.pentaho.reporting.engine.classic.core.states.cachingdatafactory.querydata(cachingdatafactory.java:144) @ org.pentaho.reporting.engine.classic.core.states.cascadingdatafactory.querydata(cascadingdatafactory.java:110) @ org.pentaho.reporting.engine.classic.core.states.datarow.reportdatarow.createdatarow(reportdatarow.java:97) @ org.pentaho.reporting.engine.classic.core.states.datarow.defaultflowcontroller.performquery(defaultflowcontroller.java:189) @ org.pentaho.reporting.engine.classic.core.states.process.processstate.<init>(processstate.java:279) @ org.pentaho.reporting.engine.classic.core.layout.output.abstractreportprocessor.preparereportprocessing(abstractreportprocessor.java:463) @ org.pentaho.reporting.engine.classic.core.layout.output.abstractreportprocessor.processreport(abstractreportprocessor.java:1412) @ org.pentaho.reporting.engine.classic.samples.abstractreportgenerator.generatereport(abstractreportgenerator.java:218) @ org.pentaho.reporting.engine.classic.samples.abstractreportgenerator.generatereport(abstractreportgenerator.java:128) @ org.pentaho.reporting.engine.classic.samples.report2013html.main(report_html.java:103)
Comments
Post a Comment