datasourceTools.zip (4.59 KB)
Attached is a small JEXL extension that will allow you to load database publishing credentials from the JNDI configuration files for the Rhythmyx server.
it will install the variable: $user.datasourceTools
and will allow templates or bindings which can contain statements like:
#set($config = $user.datasourceTools.getDatasourceConfig('MyConnectionName'))
<p>Name: $config.name<br/>
DataSource: $config.dataSource<br/>
Origin: $!{config.origin}<br/>
Database: $!{config.database}<br/>
</p>
#set($datasource = $user.datasourceTools.getJndiDatasource($config.dataSource))
<p>Name: $datasource.name<br/>
Driver: $!{datasource.driverName}<br/>
Server: $!{datasource.server}<br/>
User: $!{datasource.userId}<br/>
Password: $!{datasource.password}<br/>
Security Domain: $!{datasource.securityDomain}<br/>
Idle Timeout: $!{datasource.idleTimeout}<br/>
Max Connections: $!{datasource.maxConnections}<br/>
Min Connections: $!{datasource.minConnections}<br/>
</p>
There’s also a means to lookup a datasource given a server address:
$user.datasourceTools.getJndiDatasourceByServer(’@hostname:port:dbname’)