Sample ODA data source
Creating a custom user interface to connect to a BIRT JDBC data source does not require additional coding. You must configure the data source and data set and describe the data set columns in the erni_config.xml file, as shown in Listing 14-3.
Listing 14-3  
<odaconfig>
  <name>OdaSample</name>
  <displayName>Sample ODA data source</displayName>
  <description>A sample ODA data source</description>
      <datasourceExtensionId>org.eclipse.birt.report.data.oda.jdbc  
  </datasourceExtensionId>
  <datasourceDisplayName>CLASSICMODELS</datasourceDisplayName>
      <datasetExtensionId>org.eclipse.birt.report.data.oda.jdbc.
  JdbcSelectDataSet</datasetExtensionId>
  <datasetDisplayName>CLASSICMODELS.PAYMENTS</datasetDisplayName>      
      <odaDriverClass>org.eclipse.birt.report.data.oda.sampledb.
  Driver</odaDriverClass>
  <odaURL>jdbc:classicmodels:sampledb</odaURL>
  <odaUser>ClassicModels</odaUser>
  <!--     <odaPassword>      </odaPassword>     -->
<!-- Data Type can be DECIMAL(3)/INTEGER(4)/FLOAT(6)
/DATE-TIME(93)/DATE(91)/TIME(92)/BOOLEAN(16)/STRING(12)-->      
  <odaColumns>
    <odaColumn>
      <name>CUSTOMERNUMBER</name>
      <dataType>INTEGER</dataType>
    </odaColumn>
    <odaColumn>
      <name>PAYMENTDATE</name>
      <dataType>DATE</dataType>
    </odaColumn>
    <odaColumn>
      <name>CHECKNUMBER</name>
      <dataType>STRING</dataType>
    </odaColumn>
    <odaColumn>
      <name>AMOUNT</name>
      <dataType>FLOAT</dataType>
    </odaColumn>                
  </odaColumns>
  <dataObject>CLASSICMODELS.PAYMENTS</dataObject>
  <!--     <queryText>      </queryText>     -->    
  <enabledInWorkgroupMode>false</enabledInWorkgroupMode>
  <enabledInEnterpriseMode>true</enabledInEnterpriseMode>
  <entryPoint></entryPoint>
</odaconfig>
To test the sample ODA data source with BIRT Studio, you must first enable the data source, named OdaSample, by setting the data source’s <enabledInEnterpriseMode> attribute in erni_config.xml to true. The erni_config.xml file is stored in the following location:
<context root>\WEB-INF
Typically, in standard installations the <context root> is as follows:
In iHub:
<ACTUATE_HOME>\iHub2\servletcontainer\iportal
In Information Console:
<ACTUATE_HOME>\iPortal\iportal
After you enable the sample data source, restart the appropriate Windows service for iHub or Information Console, and open BIRT Studio. When prompted, select one of the standard report templates. The Data Source dialog box, as shown in Figure 14-12, prompts you to select a data source. Select Sample ODA data source.
Figure 14-12  
Based on the XML definition in erni_config.xml, the product displays a sample ODA editor with a table, containing the configured database columns, as shown in Figure 14-13.
Figure 14-13  
The check boxes appearing next to the column names allow the user to select the data for the report. The editor gives the user ability to create a parameter for filtering the data in the last column.
Table 14-1 lists all the configuration attributes and their descriptions.
Configuring the ODA data source requires knowledge about your JDBC data source and data set. If you do not know this information, you can obtain the database connection properties from your database administrator. It is a good practice to create first a sample report in BIRT Designer Professional and validate the connection and the database query. You use the XML source of the created report to identify the correct values for the sample ODA configuration. Look for the attribute values in the <data-sources> and <data-sets> tags at the beginning of the report XML.
Listing 14-4 shows portions of the report XML that contain the configuration attributes and their values.
Listing 14-4  
<data-sources>
  <oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source" id="7">
  …
  <property name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver</property>
  <property name="odaURL">jdbc:classicmodels:sampledb</property>
  <property name="odaUser">ClassicModels</property>
  </oda-data-source>
</data-sources>
<data-sets>
<oda-data-set extensionID=
  "org.eclipse.birt.report.data.oda.jdbc.  JdbcSelectDataSet" name="Data Set" id="8">
  …
  <xml-property name="queryText"><![CDATA[select *
  from CLASSICMODELS.PAYMENTS]]></xml-property>

Additional Links:

Copyright Actuate Corporation 2013 BIRT iHub 2