Setting up the connection configuration file
In a BIRT report design, the configuration key that specifies a data source is the concatenation of the ODA plug-in’s data source extension ID and the data source design name separated by an underscore (_) character.
The connection property names are the connection properties defined for your data source. To find the correct names for the connection properties, check the data source definition in the XML source of the BIRT report design file. You can view the report’s XML source by selecting the XML Source tab in the report editor.
The code example in Listing 27-3 shows the XML definition of a MySQL Enterprise database in a report design. Using this data source, the report developer can test the report in development. This XML data source definition specifies the connection properties, odaDriverClass, odaURL, odaUser, and odaPassword, for the data source, ClassicModels.
Listing 27-3  
<data-sources>
  <oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Customers" id="4">
    <property name="odaDriverClass">
      com.mysql.jdbc.Driver
    </property>
    <property name="odaURL">
      jdbc:mysql://localhost/ClassicModels
    </property>
    <property name="odaUser">root</property>
    <property name="odaPassword">pwd</property>
  </oda-data-source>
</data-sources>
At run time, the report uploaded to iServer connects to a production database that resides on a different database server. The connection properties specify a machine IP address, 192.168.218.226, and a different username and password. To externalize the database connection information, create the configuration property file, DBConfig.xml, with the settings shown in Listing 27-4.
Listing 27-4  
<Config>
<Runtime>
<ConnectOptions Type="org.eclipse.birt.report.data.oda.jdbc_Customers">
  <Property PropName="odaDriverClass">
    com.mysql.jdbc.Driver
  </Property>
  <Property PropName="odaURL">
    jdbc:mysql://192.168.218.226:3306/ClassicModels
  </Property>
  <Property PropName="odaUser">operator</Property>
  <Property PropName="odaPassword">pwd</Property>
</ConnectOptions>
</Runtime>
</Config>

Additional Links:

Copyright Actuate Corporation 2012