![WSO2: Setting Up Dynamic Database Connections in DB Reports or Lookups Using the Registry.](https://www.massiltechnologies.com/wp-content/uploads/2021/10/career-3.jpg)
When specifying the DB connection using a connection pool, instead of specifying parameter values inline, you can also define the Driver, URL, User, and password as registry entries. The benefit of using a registry entry for a parameter value is the ability to utilize the same connection information configurations in various environments by merely adjusting the registry entry value.
Walkthrough:
Create separate text files and save values for each database parameter, such as URL, username, and password.
![](https://www.massiltechnologies.com/wp-content/uploads/2024/04/WSO1.1-e1713370851687.png)
The image shows the text file that needs to be imported into the project registry.
![](https://www.massiltechnologies.com/wp-content/uploads/2024/04/WSO1.2-1024x576.png)
Creating a Registry Resource
Right-click on the Registry Resource project and then click New -> Registry Resource
This will open the New Registry Resource window.
- Select the import from file system
- Click on Next
![](https://www.massiltechnologies.com/wp-content/uploads/2024/04/WSO1.3-1024x576.png)
Please specify the values for the following parameters: Artifact Name, select registry (i. e. gov or conf), Registry path, and the registry under which to save. Finally, click Finish.
![](https://www.massiltechnologies.com/wp-content/uploads/2024/04/WSO1.4-1024x576.png)
Now configure the DB Report/Lookup configuration to read DB parameter values from the registry as shown below.
![](https://www.massiltechnologies.com/wp-content/uploads/2024/04/WSO1.5.png)
In the source view, the DB Lookup configuration looks as below.
![](https://www.massiltechnologies.com/wp-content/uploads/2024/04/WSO1.6.png)
The article has so far talked about setting up dynamic database connections in DB in WSO2. For more information or queries around WSO2, please write to [email protected].