Setting connection properties when a report runs
When you first design and test a report, you create a BIRT data source that uses hard-coded information. For example, the procedure for creating a JDBC data source includes providing a user name and password that the report uses to access a database. When the report is run, the database uses whatever user groups and privileges are assigned to the hard-coded report user.
Production reports, however, cannot always use the hard-coded information specified at report design time. A typical example is prompting a report user to provide his credentials when he runs the report. Based on the specified credentials, the database authentication system determines the appropriate data to use to generate the report.
To support the setting of connection properties at report run time, the data source editor provides a feature called property binding. As its name suggests, this feature supports binding each connection property to a JavaScript expression that evaluates to a value that the report uses at run time.
Because each data source type requires different connection information, the Property Binding page displays a different set of connection properties for each data source type. The Property Binding page is available only when you edit an existing data source. It is not available when you create a new data source.
Figure 1‑7 shows the Property Binding page for a JDBC data source.
Figure 1‑7 Property Binding page showing JDBC connection propertiesthat can be set at run time
Figure 1‑8 shows the Property Binding page for a flat file data source. Notice that, for both types of data sources, all the connection properties that you set at design time can also be set dynamically at run time. As the figures also show, if the data source uses a connection profile, you can dynamically assign a connection profile and its location at run time.
Figure 1‑8 Property Binding page showing flat file connection properties that can be set at run time
The following sections show two examples of setting connection properties at run time.