Best view in Firefox and Chrome

Jasper Report - Creating first Report

Wednesday, March 12, 2008
Convert Article to PDFPrint ArticleEmail Article to FrinedBookmark this Article


How to Setup JasperReport using iReport

First we need a iReport Designer. Download iReport Designer 1.2.0 for Jasper Reports Tool from http://sourceforge.net/projects/ireport

Extract the compressed iReport-1.2.0.zip file in a directory (i.e in C:\ReportGenerator directory). You should have the following directories in your C:\ReportGenerator\iReport-1.2.0 directory.

iReport-1.2.0
|
- \bin
|
- \docs
|
- \fonts
|
- \lib
|
- \plugins
|
- \templates


You can now run iReport Designer by clicking iReport.bat file in your C:\ReportGenerator\iReport-1.2.0 directory.

Now We have sucessfully setuped the iReport Designer in your local system. Then we see how to configure the Database Connection to this iReport Designer.

How to configure the Database connection

Run iReport by clicking iReport.bat file in your C:\ReportGenerator\iReport-1.2.0 directory. Set up your database connection through menu item "Datasource" and then "Connections/Data sources".
Define a new data source by clicking new button. Enter the following properties for your database connection:

Name: any name you like for instance OracleCISE.
Type of Connection: Select Database JDBC connection from the drop down list.

JDBC Driver: oracle.jdbc.driver.OracleDriver

JDBC URL:jdbc:oracle:thin:@oracle1.cise.ufl.edu:1521:orcl

Username: your cise oracle username


You do not need to enter any other connection properties. Your password will be asked when you try to connect to the database to run your report.

Note : This connection configuration is saved in your C:\Documents and Settings\WindowsUserName\.ireport\config.xml file.

Let we configure the Classpath

Place Oracle Database connection library (classes12.jar) into your lib directory. ( For example place it in C:\ReportGenerator\iReport-1.2.0\lib directory.)
Open the Classpath window by clicking "Tools" and then "Classpath" menu.
Click on the "Add JAR/Folder" button and define the path of classes12.jar.
Save Classpath by clicking "Save classpath" button.

Start to Develop a iReport

You can now start designing your reports to present the data in your database.
To create a new report click on "New Document" in the File menu.
In the library window, on the right hand side, you see a list of items: Fields, Variables, Parameters, Page Number, etc.
Fields are the database column names from where your report will retrieve data. To define the database fields, you need to define the Report Query.
Define your Report Query by selecting report query menu item in the Datasource Menu.
Write down your SQL SELECT statement. (As you write your query, you will be prompt for your password.)

After writing my query "SELECT * FROM THEATER", I got the following screen:
You will see the list of columns from your query under the fields list in the library window on the left hand side of the iReport designer.
Drag and drop database fields from the field list onto Detail section of your report.
Put static fields (Static Text Field) onto ColumnHeader section of your report to define the data you are presenting. Select descriptive titles for your data.
Put a descriptive title for your report in the Title section.
Resize the Detail, Header and Footer sections if needed.
Your report design may look like this:
Save your report.
Run your report by clicking on or by clicking on the Execute Report (using active connection) in the Build menu.

In my next post, we will see how to connect this jasper reports into a java application.

:)

Read these Articles :

0 comments:

Why Breeze

This is a new technological rhythm in the web. It blooms like a Breeze in your technological face with more than 75 technoligical atricles and guidences.

Contact Me
Contact Me Send an Email Facebook Account LinkedIn profile Twitter/Shayanth
Share And Save
Social Share with Twitter Facebook Share Add to Google Save on Delicious
Get Updates

The RSS will facilitate you to get the updates from Breeze. Click Here to redirect to the RSS link.

Designed by Posicionamiento Web | Bloggerized by GosuBlogger | Blue Business Blogger | Customized by SHAUOM