Note that there are some explanatory texts on larger screens.

plurals
  1. POCan JDBC connection files contain computed properties?
    primarykey
    data
    text
    <p>In the book "XPages Extension Library", Chapter 12, page 409 there is an example of JDBC connection file:</p> <pre><code>&lt;jdbc&gt; &lt;driver&gt;org.apache.derby.jdbc.EmbeddedDriver&lt;/driver&gt; &lt;url&gt;jdbc:derby:${rcp.data}\derby\XPagesJDBC;create=true&lt;/url&gt; &lt;user&gt;phil&lt;/user&gt; &lt;password&gt;phil&lt;/password&gt; &lt;/jdbc&gt; </code></pre> <p>It is also mentioned in the text that "notice in previous example the use of the configuration property <strong>rcp.data</strong> in the computed expression ${rcp.data}. The connection files can take advantage of <em>computed properties</em> in their definitions."</p> <p>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:</p> <pre><code>&lt;user&gt;${SettingsBean.SQLUserName}&lt;/user&gt; &lt;password&gt;${SettingsBean.SQLPassword}&lt;/password&gt; </code></pre> <p>However, I cannot get this to work. Here is what I have tried so far:</p> <ol> <li>Managed beans</li> <li>VariableResolver</li> <li>Resource bundle</li> <li>writing the connection file directly and through java.util.Properties</li> </ol> <p>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).</p> <h2>EDIT:</h2> <p>Some additional information:</p> <ul> <li>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.</li> <li>XPagesJDBC.nsf does not contain the word "rcp.data" elsewhere, at least it does not show up in search.</li> <li>The JDBC connection works flawlessly if username is hardcoded.</li> <li>The SQL error messages look something like this: <code>Unknown user: "${SettingsBean.SQLUserName}"</code> which seems to imply that this connection file is used "as-is".</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload