Page 1 of 1
Dynamically change Data Source
#2
Posted 08 February 2012 - 03:39 PM
MarkW, on 08 April 2011 - 04:47 PM, said:
How can I change the data source using the engine API?
Here is what we use:
Source[] sources = document.getBook().getDataSourceCollection().get();
for (Source source : sources) {
if (source instanceof JDBC) {
JDBC jdbc = (JDBC) source;
jdbc.set(jdbcDriver, jdbcUrl, jdbcUsername, jdbcPassword, false);
}
}
Note: using JNDI does not seem to work, nor are we able to inject a JDBC Connection directly. However, specifying driver, url, username and password works.
With kind regards,
Barry Lagerweij
Page 1 of 1






MultiQuote
