Hi,
i have some issues when i try to send paramters map to jasper template. I set a simple HashMap and send to jasper report using fillReport() method as following:
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("code", "myCode");
.........
JasperFillManager.fillReport(jasperReport, parameters, connection);
i used the following datasource:
String connectionURL = "jdbc:postgresql://" + hostName + ":5432/" + sid;
connection = DriverManager.getConnection(connectionURL, userName, password);
In the template jrxml file i have the following code to retrieve and exec query:
<parameter name="code" class="java.lang.String"/>
<queryString> <![CDATA[select * from mySchema.myTable where myField = $P{code}]]> </queryString>
It doesn't throw any errors but it doesn't properly read the value of code parameters which i set before:
DEBUG JRJdbcQueryExecuter:362 - SQL query string: select * from mySchema.myTable where myField = ?
DEBUG JRJdbcQueryExecuter:569 - Parameter #1 (code of type java.lang.String): null
I have tried the project with two versions of JasperReport library (6.1.1 & 6.3.0) but still I have the same issue.
Please help me to sort out the issue.
Thanks in advance.
Just found that the parameters works fine if I give empty datasource
JRDataSource dataSource = new JREmptyDataSource();
But with the JDBC it doesn't work. Any suggestions please.