Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:54:02+00:00 2026-05-16T17:54:02+00:00

I am trying to learn JasperReports on some online tutorial sites but I cant

  • 0

I am trying to learn JasperReports on some online tutorial sites but I cant seem to make this simple snippet work.

I wanted to select a date field from my DB and pass it into my jrxml file.

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
              name="ToolDemo"
              columnCount="2"
              columnWidth="240" pageWidth="612" pageHeight="792">
    <import value="java.util.Date"/>

    <queryString>
        <![CDATA[select a.id, a.date_acquired from tools a where a.country = 'Oceania']]>
    </queryString>

    <field name="id" class="java.lang.String"/>
    <field name="date_acquired" class="java.util.Date"/>

But I cant get pass the filling process and I am having an error: Unable to get value for field date_acquired of class "java.util.Date". I tried making use of import tag also.

Any idea please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:54:03+00:00Added an answer on May 16, 2026 at 5:54 pm

    I’ve copied your report template, create sample MySql database with one table

    +--------+-------------+------+-----+---------+-------+
    | Field  | Type        | Null | Key | Default | Extra |
    +--------+-------------+------+-----+---------+-------+
    | id     | varchar(20) | YES  |     | NULL    |       |
    | a_date | date        | YES  |     | NULL    |       |
    +--------+-------------+------+-----+---------+-------+
    

    Then I inserted one row:

    insert into tools(id, a_date) values('1', '2010-05-01');
    

    Test query:

    mysql> select * from tools;
    +------+------------+
    | id   | a_date     |
    +------+------------+
    | 1    | 2010-05-01 |
    +------+------------+
    1 row in set (0.00 sec)
    

    After that I used your template and tested it under iReport tool. Just open you report using iReport.

    Your report template with little modifications:

    <?xml version="1.0" encoding="UTF-8"?>
    <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
        <property name="ireport.zoom" value="1.0"/>
        <property name="ireport.x" value="0"/>
        <property name="ireport.y" value="0"/>
        <import value="java.util.Date"/>
        <queryString>
            <![CDATA[SELECT a.id, a.a_date FROM tools a]]>
        </queryString>
        <field name="id" class="java.lang.String"/>
        <field name="a_date" class="java.sql.Date"/>
        <title>
            <band height="79" splitType="Stretch"/>
        </title>
        <detail>
            <band height="125" splitType="Stretch">
                <textField>
                    <reportElement x="100" y="24" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression class="java.lang.String"><![CDATA[$F{id}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement x="200" y="24" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression class="java.util.Date"><![CDATA[$F{a_date}]]></textFieldExpression>
                </textField>
            </band>
        </detail>
    </jasperReport>
    

    Using mysql database connection and report template i tested report generation under iReport and it works fine.

    Are you sure that field “date_acquired” is type of DATE (or another format for dates in your database) in database? I recommend you to use iReport fore report template generation. It’s very useful and prevent you from writing a lot of “boring” code. Also, it could helps you to create report fields from sql query and test it using real database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to learn a bit about PDO and is going through this tutorial .
Im trying to learn OOP but I need to see some real case scenarios
I'm trying to learn C++ so forgive me if this question demonstrates a lack
Trying to learn Django, I closed the shell and am getting this problem now
I am trying to learn some c# coding and wondering if the c++ concept
Trying to learn F# but got confused when trying to distinguish between fold and
Trying to learn some F# and I've run into a couple of hangups. Here's
trying to learn some html/css and I'm having a problem with fixed position divs.
I'm trying to learn Spring MVC 3.0 and I made a simple web to
I am trying to learn some of the basic and advanced features of visual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.