barsha_choudhury Posted August 24, 2017 Share Posted August 24, 2017 we are trying to pass a custom data source (postgresql function) to a jasper report from servlet. the code in the servlet is as follows: Map<String, Object> hm = new HashMap<String, Object>(); JRDataSource datasource = new PostgreSqlDatasource(conectionn, string1, string2, string3); hm.put("report_custom_DataSource", datasource );we have a parameter named report_custom_DataSource in the jrxml report , which is of type jr datasource. but this approach is not passing the required datasource to the report , as a result the report is not rendering on the UI . Please let us know the correct way to pass a custom data source to a jasper report. Link to comment Share on other sites More sharing options...
H Mendoza Posted August 24, 2017 Share Posted August 24, 2017 Some reference, http://community.jaspersoft.com/wiki/how-create-and-use-jrdatasource-adapter. And for the server, there used to be samples here, c:jasperreports-serversamplescustomDataSourcesrcexamplecds. Link to comment Share on other sites More sharing options...
barsha_choudhury Posted August 31, 2017 Author Share Posted August 31, 2017 while this approach works , if we have hard coded values in the data source class, and the report renders fine with these values. the question is how to get values from a postgresql database function/procedure. we need certain parameters to be passed from the report to the function, so that data is generated dynamically. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now