Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent documentation about using a file for setting DataSource parameters #1073

Open
gspadotto opened this issue Nov 2, 2024 · 0 comments

Comments

@gspadotto
Copy link

Description

On this page:
https://mi.docs.wso2.com/en/4.2.0/develop/injecting-parameters/#data-service-parameters
there's written that you can only use environment variables to inject Data Source/Data Service parameter values.

On this other page:
https://ei.docs.wso2.com/en/latest/micro-integrator/develop/injecting-parameters/#example_1
there's written that you can use a file to inject Inline or External DataSource parameters.

From direct experience I know that the latter is still valid in MI 4.2.0.

Is this (reading properties from a file) a feature that is going to be deprecated or are the docs from "latest" (first link) wrong?

Steps to Reproduce

Add entries to <MI_HOME>/conf/file.properties:

MyJdbcDriver=org.postgresql.Driver
MyJdbcUrl=jdbc:postgresql://<host>:5432/<schema>
MyJdbcUser=MyPowerfulUser
MyJdbcPassword=MyWonderfulPassword

Refer to those entries in a datasource definition:

<datasource>
    <name>MyDatasource</name>
    <description>MyDatasource with property values in a file</description>
    <jndiConfig useDataSourceFactory="false">
        <name>MyDataSourceJNDI1</name>
    </jndiConfig>
    <definition type="RDBMS">
        <configuration>
            <driverClassName>$FILE:MyJdbcDriver</driverClassName>
            <url>$FILE:MyJdbcUrl</url>
            <username>$FILE:MyJdbcUser</username>
            <password>$FILE:MyJdbcPassword</password>
        </configuration>
    </definition>
</datasource>

Use the datasource in a DataService or in DbLookup/DbReport mediators:

<dblookup>
    <connection>
        <pool>
            <dsName>MyDataSourceJNDI1</dsName>
        </pool>
    </connection>
    <statement>
        <sql><![CDATA[
              SELECT v."myAttribute"
              FROM public.mytable v WHERE v."uniqueIdentifier" = ?]]></sql>
        <parameter expression="$ctx:uniquePropertyValue" type="VARCHAR"/>
        <result column="myAttribute" name="foundAttribute"/>
    </statement>
</dblookup>

Version

4.2.0

Environment Details (with versions)

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants