As far as i know we can't do this because there is no dependency mechanism between two report parameters in BIRT, except cascaded parameters. In this case it means the selected value of parameter "db" is never available when the list of items of "Company" is being evaluated.
Therefore the database should be provided using a different approach. You have a couple options here:
Option 1: Session attribute (if you make use of an application server)
Store the selected database in a user session attribute, and then retrieve it in the property binding of the JDBC URL with an expression such:
reportContext.getHttpServletRequest().getSession().getAttribute("db");
- Advantage 1: the database can be different for each user
- Advantage 2: the database can be dynamically changed for each user
- Drawback: Requires to develop a small servlet allowing to select the database and store it in user session
Option 2: Connection Pool (if you make use of an application server)
This should always be the favorite way to access a JDBC datasource with BIRT. We just have to fill a JNDI URL in the datasource (see your first screen above). The physical database URL and credentials are defined on each application server in a connection pool.
- Advantage 1: completely native, nothing specific to be developed
- Advantage 2: connection pooling are much more efficient than direct-access JDBC
- Advantage 3: connection pooling prevents "Too many connections" issues
- Advantage 4: we don't have to hard-code database URL & credentials in reports
- Drawback: This JNDI URL is shared by all users.
Visit this article to see an example of using a connection pool with BIRT.
Option 3: Externalize DB in Properties file
As you mentionned database informations can also be externalized in a file.
- Advantage 1: we don't have to hard-code database URL & credentials in reports
- Advantage 2: we can also develop a small servlet to update this properties file through a GUI
- Drawback: This database is shared by all users.
Please check this topic to see how to access a properties file through resources of a report
Option 4: Connection profile store
- Advantage: we don't have to hard-code database URL & credentials in reports
- Drawback: This database is shared by all users.
Please check this topic to see how to define a connection store