First of all, you have to declare the fields you retrieve from the database in your report. From your example, I suppose the fields are student_name
, nationality
and department
, all of them should have the class set to java.lang.String
, since they are all varchars
.
Your field declaration should look like this:
<field name="department" class="java.lang.String"/>
You will then be able to use them like $F{fieln_name}
.
Now, I suppose you want to see the result data in a table.
In this case, you will have declare the fields in the TableDataset
and then just put a TextField in a cell and set its TextField expression to something like $F{department}.
Also, for this case, make sure to put the query in the TableDataset, not in the main dataset of the report.