Is it possible to use placeholders in WSO2 DSS db connection params - e.g. ${prod.db.url} and replace them in runtime from Registry? Thanks.
-
You could configure a datasource from Configure/Datasources and then reference to it. In the drop down menu, you should choose Carbon Datasource. The "Name" field is the name of the Datasource. "Id" is the ID that you would use for this Datasource in this service. – Maria Ivanova Mar 30 '17 at 11:08
2 Answers
The datasource connection is checked and established in the dataservice deployment time. Therefore, you have to provide the datasource configurations such as driver class name, connection url. etc. at the deployment time.

- 1,419
- 2
- 18
- 31
Since the datasource configurations like db url, driver name, user name, password is needed during deployment stage, its not possible to refer the same from registry.
I assume your requirement comes from the need to manage different environments, to achieve the same, have the option to create datasources at server level, called Carbon_Datasources.
These datasources can be referred from .dbs
file like the below one. In the below example, serviceDS
is the datasource configured.
<config id="rs">
<property name="carbon_datasource_name">serviceDS</property>
</config>
<query id="deliveryService" useConfig="rs">
Refer here for adding different types of datasources and here for managing the same.

- 2,226
- 1
- 24
- 34