Search code examples
jasper-reportsjasperserver

JasperReports Server does not execute a query that iReport does


I am using JasperReports 4.7, iReport 4.7.1 and PostgreSQL 8.4 as database backend.

While doing a report with a query similar to

(select * from table1)
union
(select * from table1)

I found that iReport does the report but when I upload the report to the JasperReport Server I get An error has occurred. Please contact your system administrator. (6632)

I rewrote the query to

select *
from (
(select * from table1)
union
(select * from table1)
) t

And it works well with both iReport and JasperReports.

So, the question is, Am I missing something or Do I need to configure what?


Solution

  • I think it's because of the "new" (since version 4.5) security features. SQL queries should start with a select when executed on the server. (your query starts with a "(") try to disable the security check, FOR TESTING:

    security.validation.sql.on=false
    

    in:

    webapps/jasperserver/WEB-INF/classes/esapi/security-config.properties