Translate

Monday 12 January 2015

Fresh setup of Jasper Reports from scratch - For beginners

I have been thinking to compile  a document which outlines the complete process of installation and setup of the connection because generally when one starts they do not find much of material and they tend to get stuck on a trivial issue.

So the post will have two portions, namely Installation and Setup.


Installation 

This document will apprise you with the basic installation software, which would act as a prerequisite to run Jasper Report.
  1. Java
    As Jasper Reports is built on Java platform, so a proper installation of Java Development kit (jdk) is required. For official steps to install java one can refer to the link
    https://www.java.com/en/download/help/windows_manual_download.xml
  2. iReport Designer
    This is a third party Jasper Report designing software. iReport is the most popular visual designer tool for JasperReports Library and JasperReports Server (Business Intelligence).
    The software can be downloaded in an exe run able format for windows machine, or other types of files as per the platform demands.
    http://community.jaspersoft.com/project/ireport-designer/releases


  3. Jasper Server
    This is the software which acts as the interface which provides web touch to the reports rather makes it interactive in terms of external links and the drill downs
    Below is the link from where the file could be downloaded.
    http://community.jaspersoft.com/project/jasperreports-server/releases

  4. Database  Server -
    The database server or the datasource which serves the purpose of feeding data to the report, in this projects case the setup was in the SQL Server 2008, which could vary from project to project .
     
  5. Netbeans(Optional)

Netbeans is the development environment where in you could create sciptlets for customization purposes in the Jasper Reports. You could even go on to make customizations on the charts, where in you could use the
https://netbeans.org/downloads/ (Download the SE version)



Setup and Connection

Below are the steps for the setup, which would act as a prerequisite to run Jasper Report.
  1. Java
    Download and install java 7, please do mind not to install Java 8 as it is yet not supported by iReport.
  2. iReport Designer
    After installing the iReport, first thing you need to do is that the inclusion of java connector

    Below is the process to include the Java Connector

    i.  Download the Java connector for the Datasource, as we have the SQL Server datasource we need to download
    http://www.java2s.com/Code/Jar/s/Downloadsqljdbc120jar.htm
    For more info on the Connector follow the link -- https://docs.oracle.com/cd/E19501-01/819-3658/gcfoy/index.html

    ii.  Navigate to Tools—> Options  Classpath
    And select the Add JAR, and then browse to the downloaded path of the connector

    Now we  need to add a JDBC datasource

    i. Click on  the icon shown below on the top of the iReport window




  1. ii.  In the popup select New  Select The Datasource type as Database JDBC Connection

    iii. Now Enter the name of the connection, select the SQL Server driver and enter the name of the database in the url of the database, also key in your credentials, refer to the screenshot below





    iv. Now test the connection, it will say the connection successful.

    We are now ready to create reports.

  2. Jasper Server
    After installation in order to run Jasper Server open the browser and key in
    localhost:8080/jasperserver
    Then login using the credentials jasperadmin/jasperadmin

    Then setup the connection, righ click on the node and add a datasource
    Enter the details below,  for the connector and setup the datasource.



The above steps are pretty basic and gives a fair idea as to what all basic necessities are there to process the installation and setup.

4 comments:

  1. Hi Ankur,

    I am very new to Jasper reports.While trying to use Functions like "IF " and
    "ISERROR" in Ireport ,I am getting few errors.Can you please share any articles or videos to help me out.

    Thanks,
    Siva Vulli

    ReplyDelete
    Replies
    1. No There are no such functions but you can see the log file, the only conditional statement used is ternary
      So try using that, how that this helps.

      Thanks
      Ankur

      Delete
  2. Hi Ankur, I was looking for a drill down report sample and got to see your video. I was able to add sql driver to ireport and was able to preview the report based on the jrxml. But I'm not able to add sql driver to Jasper server. Could you please help?

    ReplyDelete

Please post your queries or suggestions here!!