Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Dynamic Data Source(Dataset driven parameters error)
Dynamic Data Source [message #1764959] Mon, 05 June 2017 05:55
David Good is currently offline David GoodFriend
Messages: 41
Registered: September 2012
Member
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

Previous Topic:Bringing Multiple Datasets Into Report
Next Topic:Export to spudsoft excel results as html page
Goto Forum:
  


Current Time: Fri Apr 26 13:34:55 GMT 2024

Powered by FUDForum. Page generated in 0.03194 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top