Integration Process of the Set calculator and Birt

Source: Internet
Author: User
Tags dateformat

The assembler provides standard JDBC and report tools for easy integration with Birt in Web deployment. The following describes the integration process in the development environment and web application environment.

1. Integrate 1.1 in the development environment and create a configuration file

Two configuration files, config. xml and dfxconfig. XML, are required to create the JMX.

1.1.1, config. xml

<? XML version = "1.0" encoding = "UTF-8"?>

<Config version = "1">

<! -- Registration code -->

<Regcode> [email protected] </regcode>

<Charset> GBK </charset>

<! -- Configure the addressing path of the DFX file, which is an absolute path. You can set multiple paths separated. The path of the DFX file can also be placed on the class path of the application project. The order of file loading is higher than that of the addressing path -->

<Dfxpathlist>

<Dfxpath> D:/dfxs </dfxpath>

</Dfxpathlist>

<Dateformat> yyyy-mm-DD </dateformat>

<Timeformat> hh: mm: SS </timeformat>

<Datetimeformat> yyyy-mm-DDHH: mm: SS </datetimeformat>

<! -- Data source configuration method 1: configure the connection pool on the application server and specify the data source name here -->

<Dblist>

<! -- Data Source Name, which must be the same as the data source name in the DFX file. Connect to the hsql database here -->

<DB name = "Demo">

<Property name = "url" value = "JDBC: HSQLDB: hsql: // 127.0.0.1/demo"/>

<Property name = "driver" value = "org. HSQLDB. jdbcdriver"/>

<Property name = "type" value = "hsql"/>

<Property name = "user" value = "sa"/>

<Property name = "password" value = ""/>

<Property name = "batchsize" value = "1000"/>

<Property name = "autoconnect" value = "false"/>

<Property name = "useschema" value = "false"/>

<Property name = "addtilde" value = "false"/>

</DB>

</Dblist>

<Mainpath/>

<Temppath> temp </temppath>

<Bufsize> 65536 </bufsize>

<Localhost/>

<Localport> 0 </localport>

<Loglevel> debug </loglevel>

<Callxparallel> 1 </callxparallel>

<Nodeparallel> 1 </nodeparallel>

</Config>

1.1.2, dfxconfig. xml

<? XML version = "1.0" encoding = "GBK"?>

<Dfxconfig>

<Maxconcurrents> 10 </maxconcurrents>

<Maxwaits> 10 </maxwaits>

<Log> </log>

</Dfxconfig>

1.2 create a report and load the driver jar

Create a report and create a JDBC datasource data source under datasources. Next:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/44/7E/wKioL1Ph1W6TxywhAADjIQuFXjo409.jpg "style =" float: none; "Title =" esproc_birt_integrate_1.jpg "alt =" wkiol1ph1w6txywhaadjiqufxjo409.jpg "/>

In the "Create data source" window, click "manage drivers" to add the JDBC driver jar

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/7E/wKioL1Ph1XbRSAu4AADxDv76qHw381.jpg "Title =" esproc_birt_integrate_2.jpg "style =" float: none; "alt =" wkiol1ph1xbrsau4aadxdv76qhw381.jpg "/>

Need to addDM. JarPoi-3.7-20101029.jar, Log4j_128.jar, Icu4j_3_4_5.jarDom4j-1.6.1.jarFive jar packages, which can be obtained from the IDE [installation directory] \ esproc \ lib directory. If another database is used as the data source, add the corresponding database driver package, as shown in HSQLDB. jar.

Configure the two configuration files created in step 1. XML and dfxconfig. XML is placed on the root path of classpath (the directory form classpath is not set here, You can compress the configuration file to the root directory of any jar above, such as DM. jar), and the name cannot be changed.

After that, you can select the driver class name in dirver class.Com. esproc. JDBC. internaldriver (V1.0), Enter the database URL as follows:JDBC: esproc: Local ://The username and password are empty.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/7D/wKiom1Ph1Gnwt_G0AACUkEsbxrg222.jpg "Title =" esproc_birt_integrate_3.jpg "style =" float: none; "alt =" wkiom1ph1gnwt_1_aacukesbxrg222.jpg "/>

JDBC is a fully embedded computing engine. All operations are completed in this embedded package, so the URL is local. It is not a complete database because there is no user name or password.

After entering the information, click "test connection". The data source connection test is successful.

1.3 deploy the set calculator script

Copy the dataset script (DFX) to the dfxpath configured in config. xml. The following uses stocks. DFX as an example to query the stock price of a month.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/44/7E/wKioL1Ph1hWB9jbgAABxVInU534950.jpg "style =" float: none; "Title =" esproc_birt_integrate_4.jpg "alt =" wkiol1ph1hwb9jbgaabxvinu534950.jpg "/>

1.4. Birt call

Create "data sets", select the data source you Just configured, and select the Stored Procedure for the dataset type.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/44/7E/wKioL1Ph1h3Bnk7BAADhdTJmFEE336.jpg "style =" float: none; "Title =" esproc_birt_integrate_5.jpg "alt =" wkiol1ph1h3bnk7baadhdtjmfee336.jpg "/>

Next, enter the query statement {call stocks (?)}, The Set calculator script uses the class Stored Procedure Call method, where "stocks" is the DFX name, "?" Is the passed parameter, that is, the query month.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/44/7E/wKiom1Ph1QaCR64kAAC5gZY4E5c733.jpg "style =" float: none; "Title =" esproc_birt_integrate_6.jpg "alt =" wkiom1ph1qacr64kaac5gzy4e5c733.jpg "/>

Set parameters:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/44/7E/wKiom1Ph1Q_SHZNjAADptb4_7aI626.jpg "style =" float: none; "Title =" esproc_birt_integrate_7.jpg "alt =" wkiom1ph1q_shznjaadptb4_7ai626.jpg "/>

Preview the dataset to view the query result. The call is successful.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/7E/wKioL1Ph1i7y-fZRAAD8K8jYTbw840.jpg "style =" float: none; "Title =" esproc_birt_integrate_8.jpg "alt =" wKioL1Ph1i7y-fZRAAD8K8jYTbw840.jpg "/>

2. Web deployment

Deploy the application with tomcat6.0 as an example.

2.1 prepare a Web release package

Download birt4.3.020.packet birt-runtime-4_3_0.zip, address: http://www.eclipse.org/downloads/download.php? File =/Birt/downloads/drops/R-R1-4_3_0-201306131152/birt-runtime-4_3_0.zip

Copy the webviewerexample directory to the webapps directory of Tomcat and rename it Birt.

2.2 create a configuration file

You need to prepare two configuration files, config. xml and dfxconfig. XML, which are exactly the same as those described in "integration in the development environment.

2.3 copy related jar packages

To integrate the above "in the Development Environment"DM. JarPoi-3.7-20101029.jar, Log4j_128.jar, Icu4j_3_4_5.jarDom4j-1.6.1.jarCopy to the WEB-INF \ Lib of the application and compress the above two configuration files to DM. jar.

2.4. publish a report

Copy the developed reports (such as stocks. rptdesign) to the application root directory, start Tomcat, and access: http: // 127.0.0.1: 8080/Birt/frameset? Report = stocks. rptdesign shows the following results and the deployment is successful.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/44/7E/wKioL1Ph1j2yIbx5AAHlvD6pbk8358.jpg "style =" float: none; "Title =" esproc_birt_integrate_9.jpg "alt =" wkiol1ph1j2yibx5aahlvd6pbk8358.jpg "/>


Related Article

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.