Birt Unified Public data source, dynamic switching data source solution

Source: Internet
Author: User

Reports developed through the Birt Report tool are often run in a unified production environment data source, but are often developed as a data source for development testing, which requires the ability to switch between two environments at any time. At present, in response to this problem, the public can retrieve the information, basically through the data source of the Beforeopen event, through the way of writing scripts to solve, this way is still more complex, in the number of reports, the number of developers, developers need to pay attention to the place is a bit more, not perfect. The processing of this article will be able to fundamentally solve the problem.

Can not make a fuss on the report, so that either need to modify the report file, or need each report to inherit a common library file, only in Birt Open API to find a way. By studying the source code of the Birt, we found the following solution, which basically solves the problem perfectly.

Ireportengine birtengine = ...; ireportrunnable runnable = Birtengine.openreportdesign (...); I Runandrendertask runandrendertask = Birtengine.createrunandrendertask (runnable); Map AppContext = Runandrendertask.getappcontext (); Connection conn = ...; Appcontext.put (Iconnectionfactory.pass_in_connection,conn);

This scenario requires that the connection be manually acquired at run time, and then there are issues such as closing the connection.

This method has been passed in Birt's 4.2 series and 4.4 series tests, and other versions of Birt have not been validated.

In fact, this appcontext is an important open extension interface of Birt, which can extend and customize many functions of Birt.




Birt Unified Public data source, dynamic switching data source solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.