Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:01:00+00:00 2026-06-04T13:01:00+00:00

I’m looking for some direction for coding the BIRT API w/ a datasource. I’m

  • 0

I’m looking for some direction for coding the BIRT API w/ a datasource. I’m unsure of how to configure my application to access a created datasource. If I can get some help w/this it would be great. Here’s where I am. I’ve already created a report through BIRT RCP. Now I’m looking to generate the report using a regular java application AND a web application. Both will be passing in date parameters through a GUI that I’ll be creating. Both need to have a datasource. I’ve have seen some examples here that use the Report Designer however I am not using that. I’m also NOT using the BIRT Report Creator (RCP) GUI to generate this.

Thanks

import java.util.logging.Level;
import org.eclipse.birt.core.framework.Platform;
import org.eclipse.birt.report.engine.api.EngineConfig;
import org.eclipse.birt.report.engine.api.EngineException;
import org.eclipse.birt.report.engine.api.HTMLRenderOption;
import org.eclipse.birt.report.engine.api.IReportEngine;
import org.eclipse.birt.report.engine.api.IReportEngineFactory;
import org.eclipse.birt.report.engine.api.IReportRunnable;
import org.eclipse.birt.report.engine.api.IRunAndRenderTask;

public class ReportGenerator {
    public static void main(String args[]) throws EngineException {
        ReportGenerator reportGenerator = new ReportGenerator();
        reportGenerator.executeReport();
    }

    public void executeReport() throws EngineException {

        IReportEngine engine=null;
        EngineConfig config = null;

        try{
            config = new EngineConfig( );           
            config.setBIRTHome("C:\\birt-rcp-report-designer-3_7_2\\ReportEngine");
            config.setLogConfig("c:/temp/test", Level.FINEST);
            Platform.startup( config );
            IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
            engine = factory.createReportEngine( config );      

            IReportRunnable design = null;
            //Open the report design
            design = engine.openReportDesign("ReportTemplates/testNoData.rptdesign"); 
            IRunAndRenderTask task = engine.createRunAndRenderTask(design);
            task.setParameterValue("AuthorName", "Dale DeMott");
            HTMLRenderOption options = new HTMLRenderOption();      
            options.setOutputFileName("output/resample/Parmdisp.html");
            options.setOutputFormat("html");

            task.setRenderOption(options);

            //Looking to create and insert a datasource here.
            //task.setDataSource(some parameters here that represent the ds);

            task.run();
            task.close();
            engine.destroy();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            Platform.shutdown();
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:01:01+00:00Added an answer on June 4, 2026 at 1:01 pm

    Researching this deeper I found the solution to my own question and thought I’d share the answer.

    To clarify I was looking for a way to connect my code to a datasource, so my BIRT report queries would run. I found that, I can pass in a connection via the IGetParameterDefinitionTask object by getting the application context then setting the connection in this object through a key value pair setting.

    See this line in the code below…
    task.getAppContext().put("OdaJDBCDriverPassInConnection", conn);

    public class ReportGenerator {
    public static void main(String args[]) throws EngineException {
        ReportGenerator reportGenerator = new ReportGenerator();
        reportGenerator.executeReport();
    }
    
    public void executeReport() throws EngineException {
    
        IReportEngine engine=null;
        EngineConfig config = null;
    
        try{
            config = new EngineConfig( );           
            config.setBIRTHome("C:\\birt-rcp-report-designer-3_7_2\\ReportEngine");
            config.setLogConfig("c:/temp/test", Level.FINEST);
            Platform.startup( config );
            IReportEngineFactory factory = (IReportEngineFactory) Platform.createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
            engine = factory.createReportEngine( config );      
    
            IReportRunnable design = null;
            //Open the report design
            design = engine.openReportDesign("ReportTemplates/testNoData.rptdesign"); 
            IRunAndRenderTask task = engine.createRunAndRenderTask(design);
            task.setParameterValue("AuthorName", "Dale DeMott");
            HTMLRenderOption options = new HTMLRenderOption();      
            options.setOutputFileName("output/resample/Parmdisp.html");
            options.setOutputFormat("html");
    
            task.setRenderOption(options);
    
            //Connection helper is a utility class used to create a connection to your
            //database and return it.  
            ConnectionHelper connectionHelper = new ConnectionHelper();
            Connection conn = connectionHelper.getConnection();
            task.getAppContext().put("OdaJDBCDriverPassInConnection", conn);
    
            task.run();
            task.close();
            engine.destroy();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            Platform.shutdown();
        }
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I'm making a simple page using Google Maps API 3. My first. One marker
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.