The connection priority
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:
- A user does not set datasource.xml, but sets the connection by API without specifying a data source name. Both
data source 1 and data source 2 will use the new setting.
- A user does not set datasource.xml, but sets a new connection A by specifying the data source name "data source 2". The result is:
data source 1 has no change and data source 2 will use the connection A.
- A user does not set datasource.xml, but sets two connections by API, a new connection A by specifying the data source name "data source 2" and a new connection B without specifying a data source name. The result is: data source 1 will use the connection B and data source 2 the connection A.
- A user sets "data source 2" connection in datasource.xml and a new connection A by API by specifying the data source name "data source 2". The result is: data source 1 has no change and data source 2 will use connection A ignoring the setting in datasource.xml.
- A user sets "data source 2" connection B in datasource.xml and a new connection A by API without specifying the data source name. The result is: data source 1 will use the connection A and data source 2 the connection B.
Related topics: