I have a BIRT report which connects to our test database. In the productive environment I would like to supply a datasource which is provided by the container through jndi.
How would I set the datasource programmatically for the given report?
...
IReportRunnable design = birtEngine.openReportDesign ( new File ( properties.getProperty ( "reportPath" ), report + ".rptdesign" ).getAbsolutePath () );
IRunAndRenderTask task = birtEngine.createRunAndRenderTask ( design );
PDFRenderOption options = new PDFRenderOption ();
options.setOutputFormat ( PDFRenderOption.OUTPUT_FORMAT_PDF );
options.setOutputStream ( out );
task.setRenderOption ( options );
for ( Entry<String, Object> entry : parameters.entrySet () )
{
task.setParameterValue ( entry.getKey (), entry.getValue () );
}
task.run ();
task.close ();
...
I guess I would have to modify the design
but on the other hand task
has a method setDataSource
but that looks a bit like I would have to supply some xml dom elements.