Thursday 26 September 2013

How to create pdf file through database using iReport

Let's create pdf file through database using iReport tool. So proceed the following steps.

 

Requirements:

Tool:- JasperSoft iReport-4.7.0

Database:- Oracle 10g (Choose as your own database)

 

1)  Create table  in your database like below  

create table Emp(ID NUMBER(10),NAME VARCHAR2(20));
 

insert into emp values(10,'satyam');
insert into emp values(20,'pallavi');

 

 

 

2)  Here we are using Oracle database. So we need to import the "ojdbc14.jar" file to our iReport tool. For that we have to proceed the following steps 

         

     a) Select the Tools >> Options

 

         

 b)  In the next step select the classpath then click on  "Add JAR" button  for       selecting the ojdbc14.jar file.

 

 

            c) Select the ojdbc14.jar file from the list and then click OK button to load in to the iReport tool.

 

 

3)  For creating a database connection or setup proceed the following steps

         a) Click on the Report  Datasources.

 

 

       b)  Click on New button


          

      c)  Select Database JDBC connection and then click Next > button

 

        

     d)  Fill the following fields and then click on Test button for testing the database connection.

 

 

      e) Select your Datasource from the list


 

4)  For creating a new report click on icon to run the report wizard

 

       

    a) In the next step a window appears select report choose as your own page eg.(Blank A4). Then click on Open this Template button.

 


     b)  In the next step fill the fields then click on Next button

 

 

5)  Click on Report query button and write the query 

 



6)  Create Employee Report using drag and drop with field names

 

 

7)  After complete designing click on preview button then save with different file types like (.pdf, .xls, .html, .CSV and so on...). Here below file is saved in pdf format.


 

 8)  Three file formats will be generate in your given location 

 


No comments:

Post a Comment