wso2wso2-enterprise-integratorwso2-integration-studiowso2-micro-integrator

wso2 micro integrator assign properties to DB connection


In one of my ESB artifacts, I’ve included a DB Mediator . Here is the part of the code…

...            
<dbreport>
                <connection>
                    <pool>
                        <driver>com.mysql.cj.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/wso2_sessions</url>
                        <user>testUser</user>
                        <password>myownpassword!</password>
                    </pool>
                </connection>
                <statement>
                    <sql><![CDATA[my SQL statement]]></sql>
                </statement>
            </dbreport>           

I'd like to store myownpassword! encrypted. I got how to set encrypted secret vaults in deployment.toml and then call them within the ESB code, i.e.

<property expression="wso2:vault-lookup('db_password')" name="db_password" scope="default" type="STRING"/>

where db_password is the alias assigned to the encrypted text. But how can I refer to the encrypted password so to assign it to the connection pool?

Thanks for help :-)


Solution

  • AFAIK you can't directly refer to secure vault entries in your DB pool configs. So one way is to save the entries in the registry and then retrieve it from the registry. But still, this will not allow you to encrypt the password.

    enter image description here

    Another option is to create an external datasource and then refer to the Datasource rather than having the DB connection details in the synapse execution flow. External Dataservices will allow you to encrypt sensitive data.