Which is the best way to use jasperreport in a PHP application?


I am new to Jasper. I have been trying to embed jasperserver in my zend php project with Mysql database. But till now I couldn't find a way to execute SQL queries via my app on Jasperserver. The PHP jasper libraries which I am using (both Rest and SOAP) is not showing me how to generate reports based on my query. So I am in a dilema that whether I should go with Jasperserver Java platform and use a php-java bridge to embed it OR can I manage querying with PHP itself?.. Any help is appreciated.....

deepaknair.g's picture
Joined: Jul 28 2013 - 11:59pm
Last seen: 9 years 5 months ago

2 Answers:

ajinkya_c's picture
Joined: Aug 29 2012 - 6:13am
Last seen: 5 years 10 months ago

First of all, thanks a lot for your support. I had gone through these links earlier. I had success in downloading a report from jasperserver. But I couldn't find any ways to create report via php code with respect to SQL queries. There is no documentation regarding this and no methods are there for this in rest, soap libraries.

deepaknair.g - 9 years 5 months ago

If you are seeking the possibility to create reports from SQL queries 'on the go' — sorry, but this is not what JRS can do. To create reports you need a tool to author jrxml files: Jaspersoft Studio or iReport. Professional version of JRS also has Ad Hoc Editor, where one can create simple table, chart and crosstab views from domains and topics. But the point of JasperReports Server is to serve as a repository for already created reports, generate them on specified schedules, and provide access control.

The furthest that JRS API can do is creating a ReportUnit resource with required dependencies and running its export as html/pdf/rtf/etc. But for that you need to have your jrxml file prepared.

With regards to PHP clients, the next big thing is https://github.com/Jaspersoft/jrs-rest-php-client. It is still in development and testing, but it's a new client that uses the new (v2) JRS REST API.

pdanyliuk's picture
Joined: Jan 24 2013 - 3:48am
Last seen: 8 years 3 months ago