Jasper Reports – Unknown Column Name Error

This is most common issue faced by many new Jasper Report Designers, Let me discuss this issue short and straight. The common is  issue is, the query your passed in your JRXML and the query we pass from the Java to JRXML file must be the same.

Let.s discuss the in more clearly understanding, Lets assume we have passed the query in Dataset of our Jasper Report.

Example like:

select apple,mango,strawberry from fruits

When we pass the above query in Dataset of our Jasper Report, the field name $F(apple),$F(mango), $F(strawberry) are formed. so we will pass the same field names in Detail band of our report Layout to get the data accordingly.

But designing the report is not yet completed, its just the first half of your report designing, to generate the report from the java we must pass the query from the Java. so sometime we mistakenly pass some other query to the jasper at the run-time of the Java program. So we must be very careful to pass the same query to Jasper Report at the compile time which we passed in Jasper Report.

If this is not the issue, there can be some other causes like:

  1. Maintaining different data sources for Java and Jasper Report.
  2. Different  Connection for Java and Jasper Report
  3. No Connection at run-time.

 

intactabode