HI,
I am working with BIRT 4.3.1 designer and a webapp with integrated BIRT 4.5.0 viewer.
We have system reports which connect to the webapp db. To develop the reports we set up the data source connection object with DEV db details.
When users select a report from the webapp in PROD the application takes database connection properties from a property file and sets them to session attributes. We can retrieve these attributes at the report level and override data source properties to connect to the correct db. Reports will run from the correct database.
The problem arises when we have report parameters driven by data sets using the same connection object. When running a report on the server the parameters load using the DEV connection details in the connection object, not the session attributes which should override them.
We have tried a number of strategies to fix this including storing the session attribute values at initialize method:
importPackage( Packages.javax.servlet.http );
importPackage( Packages.java.io );
var request = reportContext.getHttpServletRequest();
var session = request.getSession();
if (request != null && session != null) {
reportContext.setPersistentGlobalVariable("pgv_jdbcURL","jdbc:postgresql://"+session.getAttribute("dbServer")+":"+session.getAttribute("dbPort")+"/"+session.getAttribute("dbName"));
reportContext.setPersistentGlobalVariable("pgv_dbReportUser", session.getAttribute("dbReportUser"));
reportContext.setPersistentGlobalVariable("pgv_dbReportPwd", session.getAttribute("dbReportPwd"));
reportContext.setPersistentGlobalVariable("session", "true");
} else {
reportContext.setPersistentGlobalVariable("pgv_jdbcURL","")
reportContext.setPersistentGlobalVariable("pgv_dbReportUser", "");
reportContext.setPersistentGlobalVariable("pgv_dbReportPwd", "");
reportContext.setPersistentGlobalVariable("session", "false");
}
// manual override of driver class
reportContext.setPersistentGlobalVariable("pgv_dbDriver","org.postgresql.Driver");
then setting them to the data source properties in beforeFactory: (also tried this in initialize)
reportContext.getDesignHandle().findDataSource("connUGEN").setProperty("odaDriverClass",reportContext.getPersistentGlobalVariable("pgv_dbDriver"));
reportContext.getDesignHandle().findDataSource("connUGEN").setProperty("odaURL",reportContext.getPersistentGlobalVariable("pgv_jdbcURL"));
reportContext.getDesignHandle().findDataSource("connUGEN").setProperty("odaUser",reportContext.getPersistentGlobalVariable("pgv_dbReportUser"));
reportContext.getDesignHandle().findDataSource("connUGEN").setProperty("odaPassword", reportContext.getPersistentGlobalVariable("pgv_dbReportPwd"));
We have also tried binding report parameters on drill through and still the data set driven parameters use whatever is entered into the connection object, not the new properties.
Has anyone overcome a similar issue? Any assistance would be greatly appreciated.
Many thanks,
David
[Updated on: Mon, 05 June 2017 05:59]
Report message to a moderator