Create a JDBC data adapter with JasperSoft Studio Tutorial
We can use the Jaspersoft Studio for previewing reports and datasets while developing the report. To Fetch data from a data source, we can use a data adapter. In this Jasper report tutorial, we are going to demonstrate how to create a JDBC data adapter for JasperReports with JasperSoft Studio.
What is JasperReports data adapter ?
A data adapter is a resource that specifies how and where to obtain data. In JasperReports, we have different types of data adapters.
What is JasperReports JDBC data adapter ?
We can use a JDBC connection to access a database through a JDBC driver. With this JDBC connection, we can simulate the report with the database data set. This way we can test our report easily, instead of testing it by deploying the to the application.
Let's start creating our first Jasper Report JDBC data adapter.
Create a new Jasper report JDBC data adapter
First, go to the Repository Explorer palette. You will see a place to list down all the Data adapters.
Right-click on Data adapters. Then click on the Create Data adapter.
In the new pop-up window, you can see all the types of data adapters that support jasper studio. In this tutorial, we are going to use Database JDBC connection. In the next window, we have to update details about the database connection.
How to configure JDBC connection details of the Jasper report data adapter ?
You can follow the screenshot and video to configure the connection details. Here we need to configure JDBC Driver, JDBC URL, Database connection user name and password. You can name your database connection at the top, as in the screenshot.
How to configure Jasper report JDBC driver class path ?
To connect to a relational database, we have to use a JDBC driver.
We can point it in the Driver classpath tab. Here I'm using MySql JDBC connector.
You can download MySql Driver from here.
You can download Oracle Driver from here.
Once you finish your previous steps, you can test your database connection by clicking the Test button.
Finally, we have created our first jasper report data adapter. In the next tutorial, we will discuss how to use the data adapter.
For more information, check out our video for creating a jasper report data adapter.