-2

I am not able to use the below mentioned password from property file in mule4. I am trying like ${db.password} and database connectivity is failing but hardcoded value is working fine. Is it because password contain colon and semicolon?

app.properties

db.host=test
db.port=1443
db.database=test_db
db.password=DAwrtkcz%35:\zC;

xml config not working:

    <db:config name="Database_Config" doc:name="Database Config" doc:id="af868fbb-3dc2-4392-9e8d-4195343e26d9" >
            <db:mssql-connection host="${db.host}" port="${db.port}" user="${db.user}" password="${db.password}" databaseName="${db.dbname}" />
    </db:config>

xml config working:

    <db:config name="Database_Config" doc:name="Database Config" doc:id="af868fbb-3dc2-4392-9e8d-4195343e26d9" >
            <db:mssql-connection host="${db.host}" port="${db.port}" user="${db.user}" password="DAwrtkcz%35:\zC;" databaseName="${db.dbname}" />
    </db:config>

gobal.xml

   <configuration-properties doc:name="Configuration properties" doc:id="edb2306f-8ead-4bfc-8263-d78300b26ce7" file="properties\app.properties" />
10
  • What is your YAML? Did you wrap the password in quotes? Commented Aug 29, 2024 at 10:19
  • edit the question to add a minimal reproducible example. Be sure to include the Database connector configuration -as XML text, no images- and how the property file is configured. If there are any errors add them too. Use code block format for configurations, code and logs. Commented Aug 29, 2024 at 13:30
  • @HarshankBansal is .properties file not yaml Commented Aug 29, 2024 at 14:08
  • @aled I've added the xml config. Error is just connectivity failure. If i am passing hardcoded value in password it's working. Commented Aug 29, 2024 at 14:13
  • Where are you defining that property? Commented Aug 29, 2024 at 15:41

2 Answers 2

1

Maybe string password need to have a escape char to escape “\”. It would be like:

DAwrtkcz%35:\\zC;
Sign up to request clarification or add additional context in comments.

Comments

0

Use a YAML format and wrap it with quote?

src/main/resources/properties/app-config.yaml

db:
  host: "test"
  port: "1443"
  database: "test_db"
  password: "DAwrtkcz%35:\zC;"

global.xml

<configuration-properties doc:name="Configuration properties" doc:id="edb2306f-8ead-4bfc-8263-d78300b26ce7" file="properties\app.yaml" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.