If you are using a catalog connection, datasource.xml, and at the same time, you have set new connection information at runtime via the Server API/URL ((jrs.jdbc_driver, jrs.jdbc_url, jrs.db_user, jrs.db_pswd), the priority of these three is as follows:
Runtime configuration of connection > datasource.xml > catalog connection
This means that if the approach with higher priority fails to get the connection, the one with the next lower priority will be used.
The runtime configuration of connection includes the connection object and connection info (such as url, driver, and user/pwd), 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.
Assuming that the catalog has two databases named as data source 1 and data source 2, here are some examples: