Implementing a custom query executor / custom data source in Jasper server

This is small article on how to implement a custom datasource or a custom query executor in Jasper Reports Server, focused on the missing information in other tutorials/documentation available on web.  Before we start lets be clear on some of the related facts –

  1. Implementing a custom datasource in Jasper reports server is DIFFERENT from  implementing a datasource to work with iReports, in both concept and method used.
  2. A custom datasource is a datastructure that holds the information to be presented and is NOT a query executor (Meaning its not a datasource in “JDBC” or iReport sense).
  3. A query executor may create and return a custom datasource OR an instance of one of the predefined datasources.  For most of the cases, using one of the predefined datasources with a custom query executor are good enough and need to create a cutom datasource seldom arises. (please refer JasperServer documentation for information on predefined datasources).

Please refer the attached sample application  (from jasper server source) to understand how custom data source and query executors are created.

Please note these with regard to the sample application –

  1. In addition to the xml configurations in the given sample, the new query language “webscraper” has to be added in the file WEB-INF/flows/queryBeans.xml
  2. Once this is done, if the language specified in the queryString node of a JRXML is webscraper, WebScraperQueryExecuterFactory (and then WebScraperQueryExecuter) will be invoked to execute that query. This is irrespective of the datasource you have set for that report.
  3. A custom datasource has real use only when it works with a custom query executor, or when it can be created and filled with required information without the need for a query (from the report XML).

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

43,102 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>