Firstly, on your jasperserver, manage > server settings > for the property "SQL query executer", set the property value to Debug (from the drop down on the right). Secondly, clear the jasperserver.log (empty the file, don't delete) and save. Then run the report and view the query that runs, run the query in the database by replacing the ? with relevant values. This will help you check the result from your query.