WSO2: Setting Up Dynamic Database Connections in DB Reports or Lookups Using the Registry.

WSO2: Setting Up Dynamic Database Connections in DB Reports or Lookups Using the Registry.

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.

The image shows the text file that needs to be imported into the project registry.

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

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.

Now configure the DB Report/Lookup configuration to read DB parameter values from the registry as shown below.

In the source view, the DB Lookup configuration looks as below.

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].