Get custom database settings from config.xml
Posted: Mon Mar 07, 2016 2:50 pm
My config.xml contains multiple datasources:
I tried to call:
but got an Exception:
I need the "external" datasource. Do I need to parse the file with an XML parser?
- Code: Select all
<application>
<datasource>
<db name="default">
<url>jdbc:oracle:thin:@first.world</url>
<username>user1</username>
<password>pass1</password>
</db>
<db name="external">
<url>jdbc:oracle:thin:@second.world</url>
<username>user2</username>
<password>pass2</password>
</db>
</datasource>
</application>
I tried to call:
- Code: Select all
SessionContext.getCurrentSessionConfig().getProperty("/application/datasource/db")
but got an Exception:
- Code: Select all
java.lang.IllegalArgumentException: Missing index
I need the "external" datasource. Do I need to parse the file with an XML parser?