greg.fenton Posted March 1, 2007 Share Posted March 1, 2007 We have developed a custom data source so that iReports can go directly against our data model in our J2EE solution. Will JasperServer support a similar approach or is it hard-coded to JDBC? Any links to relevant docs would be greatly appreciated too! Thanks in advance,greg.fenton Link to comment Share on other sites More sharing options...
martynhiemstra Posted March 1, 2007 Share Posted March 1, 2007 You could create your own report bean. Fill it in advance with data from anywhere and send the bean to the report. It has a much better security than a direct jdbc connection. Martyn Link to comment Share on other sites More sharing options...
martynhiemstra Posted March 1, 2007 Share Posted March 1, 2007 Post edited by: martynhiemstra, at: 2007/03/01 07:47 Link to comment Share on other sites More sharing options...
greg.fenton Posted March 1, 2007 Author Share Posted March 1, 2007 martynhiemstra wrote:You could create your own report bean. Fill it in advance with data from anywhere and send the bean to the report. Would this approach be performant/scalable? Would this approach lend itself to using JasperAnalytics if we decide to add OLAP capabilities to our solution? Thanks,greg.fenton Link to comment Share on other sites More sharing options...
martynhiemstra Posted March 5, 2007 Share Posted March 5, 2007 I found that if you use a query to get information from a database you are extremly limited in the amount of information you can get from the database. If you can't get it in 1 query then you can't get it at all. With beans that isnt a issue. There you can even get information from different databases. Another advantage is that by using a bean, your front-end ( The report ) isnt directly in touch with the data ( Database ). The bean acts as a interface. The bean also acts as a database view. The report designer only sees what you want him/her to see. If the report designer can supply any query they want, they can print anything they want. If the database changes then all your reports have to change as well. If you use a bean as datasource then you have to change the business logic and not your reports. Concerning JasperAnalytics and OLAP I cant help out with that. I have no expierance with both. MartynPost edited by: martynhiemstra, at: 2007/03/05 07:56 Link to comment Share on other sites More sharing options...
wahu Posted April 7, 2007 Share Posted April 7, 2007 Yes, you can run custom data source in Jasperserver You need to add the "CustomDataSourceServiceFactory" class and register it in the applicationContext.xml public class CustomDataSourceServiceFactory { public ReportDataSourceService plainDataSource() { return new CustomDataSourceService(new CustomDataSource()); } public ReportDataSourceService tableModelDataSource() { return new CustomDataSourceService(); } public ReportDataSourceService beanArrayDataSource() { return new CustomDataSourceService(new JRBeanArrayDataSource(CustomBeanFactory.getBeanArray())); } public ReportDataSourceService beanCollectionDataSource() { return new CustomDataSourceService(new JRBeanCollectionDataSource(CustomBeanFactory.getBeanCollection())); }} You also need the CustomDataSourceService class: public class CustomDataSourceService implements ReportDataSourceService { JRDataSource ds; public CustomDataSourceService() { this.ds = new CustomDataSource(); } public CustomDataSourceService(JRDataSource ds) { this.ds = ds; } public void closeConnection() { // Do nothing } public void setReportParameterValues(Map parameterValues) { this.ds =new CustomDataSource(parameterValues); parameterValues.put(JRParameter.REPORT_DATA_SOURCE, ds); }} 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