Normally a report is fixed to a specific catalog connection after being created. You can set new connection information at runtime via the Server API. This topic describes how you can configure the runtime connection.
The runtime configuration of connection includes the connection object and connection info (such as URL, driver, and user/password), and the connection object has higher priority than the connection info.
There are two ways of changing the connection by API at runtime, one is set the connection info by specifying the data source name, which will only change the connection of the indicated data source; the other is set the connection info without a specific data source name, which is regarded as a default change and will change the connections that have not been changed by the previous way.
The following is an API example of setting database connection information:
An API sample of running a report is APIDemoRunReport.java in
<install_root>\help\samples\APIServer. You can add the preceding codes in it to change the connection when running the report.