In the book "XPages Extension Library", Chapter 12, page 409 there is an example of JDBC connection file:
<jdbc>
<driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
<url>jdbc:derby:${rcp.data}\derby\XPagesJDBC;create=true</url>
<user>phil</user>
<password>phil</password>
</jdbc>
It is also mentioned in the text that "notice in previous example the use of the configuration property rcp.data in the computed expression ${rcp.data}. The connection files can take advantage of computed properties in their definitions."
My question is: what exactly are these "computed properties" and how are they used? I would like to store the username and password somewhere else and reference them using something like this:
<user>${SettingsBean.SQLUserName}</user>
<password>${SettingsBean.SQLPassword}</password>
However, I cannot get this to work. Here is what I have tried so far:
- Managed beans
- VariableResolver
- Resource bundle
- writing the connection file directly and through java.util.Properties
1 through 3 work when referenced in an XPage, but not in this file. Number 4 would work, if the connection file were of the "key=value" type. However, java.util.Properties cannot be used with XML files that do not conform to a certain DTD (like this file). And writing the whole file is not supported (under WEB-INF).
EDIT:
Some additional information:
- The bit above is from the XPagesJDBC.nsf (from OpenNTF) and not from the image in page 409. The text on that page seems to refer to this code.
- XPagesJDBC.nsf does not contain the word "rcp.data" elsewhere, at least it does not show up in search.
- The JDBC connection works flawlessly if username is hardcoded.
- The SQL error messages look something like this:
Unknown user: "${SettingsBean.SQLUserName}"
which seems to imply that this connection file is used "as-is".