Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: embedding sql datasource into .xml file while publishing report using pentaho designe

  1. #1
    Join Date
    Aug 2007
    Posts
    198

    Default embedding sql datasource into .xml file while publishing report using pentaho designe

    Hi,
    I am designing report using pentaho designer . I am unable to look datasource in the xml. is there any way to embed sql data source to .xml file. my data source is as follows
    <report-config>
    <data:sql-datasource
    xmlns:data="http://jfreereport.sourceforge.net/n...atasources/sql">
    <data:config label-mapping="true" />
    <data:connection>
    <data:driver>com.mysql.jdbc.Driver</data:driver>
    <data:url>jdbc:mysql://localhost:3306/db?useUnicode=true&amp;characterEncoding=UTF-8</data:url>
    <data : roperties>
    <data : roperty name="user">root</data : roperty>
    <dataroperty name="password">root</dataroperty>
    </dataroperties>
    </data:connection>
    <data:query name="default">
    SELECT `role_`.`roleId`, `role_`.`companyId`, `role_`.`classNameId`, `role_`.`classPK`, `role_`.`name`, `role_`.`description`, `role_`.`type_`FROM `role_`
    </data:query>
    </data:sql-datasource>
    <simple-page-definition width="1" height="1">
    <page orientation="portrait" topmargin="20" leftmargin="20" bottommargin="20" rightmargin="20" pageformat="A4"/>
    </simple-page-definition>
    <configuration>
    <property name="org.jfree.report.NoPrinterAvailable">true</property>
    </configuration>
    </report-config>

  2. #2
    Join Date
    Oct 2007
    Posts
    235

    Default

    Not with any of the stable versions at the moment. You have to put the datasource into the xaction file. Easy way is to get the report designer to create it for you when you publish the report file, you may need to untick the jndi option

    The new citrus version which is currently in development will let you have just the report file with the data source built in. However its not .xml any more

    Good luck

    Wil
    SQL: as much of a standard as the English language

  3. #3
    Join Date
    Aug 2007
    Posts
    198

    Default Executing .xaction from java

    Hi,

    I want to get the report from xaction using standalone application, I have written this code, it is generating but when I open it, it is prompting for output type and Run in Backround.

    Please look into this code and tell where I have done wrong

    package org.pentaho.test.platform.engine.services;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.HashMap;

    import org.pentaho.platform.api.engine.IPentahoObjectFactory;
    import org.pentaho.platform.api.engine.IRuntimeContext;
    import org.pentaho.platform.api.engine.ISolutionEngine;
    import org.pentaho.platform.engine.core.solution.SimpleParameterProvider;
    import org.pentaho.platform.engine.core.system.PathBasedSystemSettings;
    import org.pentaho.platform.engine.core.system.PentahoSystem;
    import org.pentaho.platform.engine.core.system.StandaloneApplicationContext;
    import org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory;
    import org.pentaho.platform.engine.services.solution.SolutionHelper;

    public class SystemSettingsTest {
    private static final String SOLUTION_PATH = "C:/pentaho/server/biserver-ce/pentaho-solutions";
    private static final String ALT_SOLUTION_PATH = "C:/pentaho/server/biserver-ce/pentaho-solutions";
    private static final String PENTAHO_XML_PATH = "/system/pentaho.xml";
    private static final String DEFAULT_SPRING_CONFIG_FILE_NAME = "pentahoObjects.spring.xml";
    final String SYSTEM_FOLDER = "/system";

    public String getSolutionPath() {
    File file = new File(SOLUTION_PATH + PENTAHO_XML_PATH);
    if (file.exists()) {
    System.out.println("File exist returning " + SOLUTION_PATH);
    return SOLUTION_PATH;
    } else {
    System.out.println("File does not exist returning "
    + ALT_SOLUTION_PATH);
    return ALT_SOLUTION_PATH;
    }
    }

    public boolean init() {
    PentahoSystem.setSystemSettingsService(new PathBasedSystemSettings());
    File file = new File(SOLUTION_PATH + PENTAHO_XML_PATH);
    StandaloneApplicationContext applicationContext = null;
    if (file.exists()) {
    applicationContext = new StandaloneApplicationContext(
    SystemSettingsTest.SOLUTION_PATH, "");
    } else {
    applicationContext = new StandaloneApplicationContext(
    SystemSettingsTest.ALT_SOLUTION_PATH, "");
    }
    String inContainer = System.getProperty("incontainer", "false");
    if (inContainer.equalsIgnoreCase("false")) {

    System.setProperty("java.naming.factory.initial",
    "org.osjava.sj.SimpleContextFactory");
    System.setProperty("org.osjava.sj.root", getSolutionPath()
    + "/system/simple-jndi");
    System.setProperty("org.osjava.sj.delimiter", "/");
    }
    String objectFactoryCreatorCfgFile = getSolutionPath() + SYSTEM_FOLDER
    + "/" + DEFAULT_SPRING_CONFIG_FILE_NAME;
    IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
    pentahoObjectFactory.init(objectFactoryCreatorCfgFile, null);
    PentahoSystem.setObjectFactory(pentahoObjectFactory);
    return PentahoSystem.init(applicationContext);
    }

    public static void main(final String[] args) throws IOException {
    SystemSettingsTest test = new SystemSettingsTest();

    boolean init = test.init();
    if (init) {
    final String xactionPath = "/bi-developers/reporting/Test.xaction";
    ServiceTestHelper helper = new ServiceTestHelper();
    final String xactionfile = helper.getXAction(SOLUTION_PATH,
    xactionPath);
    final HashMap<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("output-type", "html");
    parameters.put("background", "No");
    //parameters.put("run_as_background","No");
    final FileOutputStream out = new FileOutputStream(
    "C:/temp/reportparveen.html");


    ISolutionEngine engine = SolutionHelper.execute(
    "Just a description used for logging ", "parveenh456",
    xactionPath, parameters, out);
    IRuntimeContext p= engine.getExecutionContext();

    out.close();

    }

    }
    }

    I am attaching my xaction also,, here I tried to remove the secured prompt filter but I am getting the following exception.

    WARN 06-08 10:18:47,984 - Region does not exist JDBC_POOL
    WARN: Failed to create data cache: com/opensymphony/oscache/general/GeneralCacheAdministrator
    ERROR 06-08 10:18:48,156 - Error Start: Pentaho Pentaho Platform Engine Core 3.0.0-STABLE.37736
    ERROR 06-08 10:18:48,156 - 6a667541-8244-11de-950e-412a8d0b9e7e:COMPONENT:context-19707269-1249534126671:Test.xactionJFreeReport.ERROR_0007 - Could not parse report bi-developers\reporting\Test.xml
    org.jfree.resourceloader.ResourceKeyCreationException: Unable to create key: No loader was able to handle the given key data: solution:/bi-developers\reporting\Test.xml
    at org.jfree.resourceloader.ResourceManager.createKey(ResourceManager.java:139)
    at org.pentaho.platform.plugin.action.jfreereport.JFreeReportComponent.parseReport(JFreeReportComponent.java:559)
    at org.pentaho.platform.plugin.action.jfreereport.JFreeReportComponent.getReportFromResource(JFreeReportComponent.java:608)
    at org.pentaho.platform.plugin.action.jfreereport.JFreeReportComponent.getReport(JFreeReportComponent.java:572)
    at org.pentaho.platform.plugin.action.jfreereport.JFreeReportComponent.executeReportAction(JFreeReportComponent.java:309)
    at org.pentaho.platform.plugin.action.jfreereport.JFreeReportComponent.executeAction(JFreeReportComponent.java:301)
    at org.pentaho.platform.engine.services.solution.ComponentBase.execute(ComponentBase.java:461)
    at org.pentaho.platform.engine.services.runtime.RuntimeContext.executeComponent(RuntimeContext.java:1322)
    at org.pentaho.platform.engine.services.runtime.RuntimeContext.executeAction(RuntimeContext.java:1289)
    at org.pentaho.platform.engine.services.runtime.RuntimeContext.performActions(RuntimeContext.java:1207)
    at org.pentaho.platform.engine.services.runtime.RuntimeContext.executeLoop(RuntimeContext.java:1156)
    at org.pentaho.platform.engine.services.runtime.RuntimeContext.executeSequence(RuntimeContext.java:1036)
    at org.pentaho.platform.engine.services.runtime.RuntimeContext.executeSequence(RuntimeContext.java:929)
    at org.pentaho.platform.engine.services.solution.SolutionEngine.executeInternal(SolutionEngine.java:413)
    at org.pentaho.platform.engine.services.solution.SolutionEngine.execute(SolutionEngine.java:316)
    at org.pentaho.platform.engine.services.solution.SolutionEngine.execute(SolutionEngine.java:192)
    at org.pentaho.platform.engine.services.solution.SolutionHelper.execute(SolutionHelper.java:228)
    at org.pentaho.platform.engine.services.solution.SolutionHelper.execute(SolutionHelper.java:139)
    at org.pentaho.platform.engine.services.solution.SolutionHelper.execute(SolutionHelper.java:76)
    at org.pentaho.test.platform.engine.services.SystemSettingsTest.main(SystemSettingsTest.java:82)
    ERROR 06-08 10:18:48,156 - Error end:
    ERROR 06-08 10:18:48,281 - 6a667541-8244-11de-950e-412a8d0b9e7e:COMPONENT:context-19707269-1249534126671:Test.xactionnull
    ERROR 06-08 10:18:48,281 - 6a667541-8244-11de-950e-412a8d0b9e7e:RUNTIME:context-19707269-1249534126671:Test.xaction RuntimeContext.ERROR_0012 - ActionDefinition for JFreeReportComponent did not execute successfully.


    Please suggest me some solution

    Thanks in advance
    Parveen
    Attached Files Attached Files

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Have a look at the Citrus-PRD, it is by far more suited to standalone development than the old PRD-3.0 one.

    PRD-3.0 and earlier is geared towards creating reports for the Pentaho-Platform and largely ignores all other aspects of how the reporting engine could be used. Therefore it does not embed datasources in the report-definition itself (which is technically supported since ages).

    With Citrus-PRD we totally rewrote this beast and created a new fileformat that runs equally well inside and outside of the Pentaho-Platform. So if you choose Citrus-PRD, you can use the reporting-engine directly and dont have to go through XActions or manual coding of datasource-definitions after you edited ther report-definition.

    Have a look at the SDK-samples:
    http://ci.pentaho.com/job/classic_engine_samples/

    For even more code samples, look at the classic-engine-demo.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.