How To Integrate JasperReport With Oracle Apex 5.1 - v2
How To Integrate JasperReport With Oracle Apex 5.1 - v2
How To Integrate JasperReport With Oracle Apex 5.1 - v2
1 using
TomCat Apache server
M Kamal Hossain
www.apexexplorer.com
[email protected]
skype: apexexplorer
Date : 24 March 2017
Process summary:
First download Oracle Apex 5.1 from the above URL. I have downloaded the Apex - All languages version as
shown below.
After downloading Apex installer unzip the file in your computer drive. I have unzipped in my machine
directory as C:\apex_5.1 as shown in the below:
Execute the below command to create Tablespace. I have assigned Tablespace size 4GB, it will take 2 to 3
minutes to complete the Tablespace creation.
Type the below command in the command prompt and press enter to execute to start Apex installation.
The apex installation will be started and it will take approximately 10 to 15 minutes. You must see the final
confirmation message and total completion time.
Below screen showing the success message of Apex installation & the total installation time as well. In my
case it took almost 15 minutes to complete. Your required installation time might be different.
After the end of successful Apex installation you will be disconnected from the database, as you can see in
the above screen shot.
Now connect in the database again using user SYS as SYSDBA privilege
Run the script apex_rest_config.sql
@ apex_rest_config.sql
After executing the script you will be asked to input the below information. For any prompted password
throughout this tutorial I have used the common password apex in your case you can put other password.
After successfully ending the execution you will see the confirmation message as shown below:
EXEC DBMS_XDB.SETHTTPPORT(0);
Step-3 Installation & Configuration of Apache Tomcat
Process Details
After downloading you will see the Tomcat 9 installer as shown below
After successfully starting the service you will see the service runtime status icon in the taskbar tray as
shown below
Leave the Apache service Runtime as it is please do not stop this service.
Now open a browser window and type the url http://localhost:8181
You can see the Apache Tomcat 9.0 home page is showing. It means the Apache Tomcat installation is
successful.
Process Details
Open a command prompt window and login database using SYS with SYSDBA privilege
Execute the below command
After downloading Oracle Rest Data service 3.0.9 unzip into your computer drive and rename the file
ords.3.0.9.348.07.16 To ords_install as shown in the below figure
Open the folder ords_install
You will see there is a file named ords.war
This ords keyword will define the url link name. if you keep the file name ords.war then your apex launching
URL will be http://192.168.2.116:8181/ords
I would like to change the URL to as my way something like based on my application name or server name or
company name ……………etc.
If my machine name is devserver and I would like to see the apex link as
http://192.168.2.116:8181/devserver then ords.war must be changed to devserver.war
In the below screen it is showing the default ords.war which you can keep it as it is if you don’t want to
change the default URL http://192.168.2.116:8181/ords
To change or customize the apex launching URL, you have to change the ords.war name to devserver.war
(or any other name that you like) before installing Rest data service.
Also, you have to change the file name ords_params.properties to devserver _params.properties under
directory C:\ords_install\params
Below screen showing the ords_params.properties has been changed to devserver _params.properties
Now edit the file devserver_params.properties by open with notepad/WordPad /notepad++ ( if you didn’t
change the file name then you have to edit ords_params.properties)
After open with any desired editor you will see the file properties of devserver _params.properties as
shown below:
INSTANCE_NAME
----------------
rnd
Now create a Manual folder named config-ords under the directory C:\ords_install as shown below
Now open a command prompt window and go inside the directory by typing cd C:\ords_install
Now type the below command to set the configuration directory to config-ords for devserver.war
installation
if Java path variable is not defined in your computer and command not executed due to java path issue then
you can replace the ‘Java’ to its full source path like
after executing the command java -jar devserver.war configdir C:\ords_install\config-ords you will see the
confirmation message as shown below
Now execute the Oracle Rest data service configuration script by running the below command
Make sure in the command prompt window you are still inside the directory C:\ords_install
Now type the below command and press enter to execute the installation of Rest Data Service
Process Details:
Copy the devserver.war file from the directory C:\ords_install and paste into the directory C:\Program
Files\Apache Software Foundation\Tomcat 9.0\webapps
Now go to the directory and copy the full content of images folder
Go the directory of C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\i
And paste the full content of the image folder in the i folder in the tom cat
Below screen showing how file moving from source folder to destination folder.
Left side source folder and right side destination folder
Process Detals:
After executing the above URL, you see below screen, the Oracle Application Express login page is appeared.
It means you have successfully completed all the installation steps.
If you see 404 page error instead of Apex login page appearing, then Stop Apache Tomcat Service and Start
again, then refresh the page or re-enter the URL, The Apex login page should appear.
Now open a command prompt window and get into the directory C:\apex_5.1\apex
Now login using SYS as SYSDBA privilege in the database
Run the script apxchpwd.sql to reset the admin password
Now launch the apex by typing http://192.168.2.116:8181/devserver
The application express login window appeared
Type below and login first time in Apex
Workspace: Internal
Username : admin
Password: <the password that you have reset in the above step>
Note: if you forgot password then reset again following the same step in the above.
After filling up credential information press “Sign In” and you will be see the apex home screen
Step: 7 Configuring Apache Tomcat to access manager & host-manager service from remote machine
Process Details
By default manager & host-manager page can’t be accessed from remote machine, only local machine is
allowed, we would like to configure the option to launch those pages from remote machine.
Go to your Tomcat Server installation folder as you see in the below screen
Create 2 XML blank file manager.xml and host-manager.xml
Copy the below XML code text and paste both in the manger.xml & host-manager.xml file and save it
See the final status after editing the above text both in the manager.xml & host-manager.xml file in the
below 2 screens.
Manager.xml file content:
host-manager.xml file content:
To test, from a remote machine type the URL http://192.168.2.116:8181/manager you will see the manager
page is showing. You can Click the /host-manager link from this page, you can view host-manager page as
well.
Process Details:
During JasperReport configuration & installation we will not keep the Apache Tomcat Service open
As shown in the below figure, you will find the Apache Tomcat service icon at the right corner of the
windows taskbar tray.
Right click the Apache Tomcat service and click “Stop Service”
Upon clicking “Stop Service” you will see the below screen the Service stopping is in progress, please do not
cancel or close until the process is completed
After completing the process you can make sure the Apache Tomcat service is showing stopped icon as
shown in the below figure
Process details
After connecting with the database using SYS, we need to create a local database Schema user
I have created a local Schema named APEXDEV using the below command, you can put any name as you like
I have assigned the default table space for this user is APEX_TS, you can assign any available tablespace that
you have
I could grant DBA, but I didn’t like to assign DBA role to APEXDEV user, but you can do that for your local
schema, there should not be any issue.
Make sure all the command below has been executed successfully.
@sys_install.sql APEXDEV
Make sure you are still connected in the database Under SYS, execute the below command to assign the
Network Access permission (ACL) for the APEXDEV & APEX_050100 user
Make sure the below command has been executed successfully and commit completed as well.
BEGIN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'ANY_HOST_ACCESS.xml',
description => 'POWER ACCESS USER',
principal => 'APEXDEV',
is_grant => true,
privilege => 'connect');
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => 'ANY_HOST_ACCESS.xml',
host => '*',
lower_port => 1,
upper_port => 9999);
end;
/
commit;
/
Please do not run the script sys_install_acl.sql, we don’t need to run it, we have
covered it in the above statement.
Now connect to the local schema APEXDEV, you can switch by typing
CONN APEXDEV then put the password and connect
Now you should make sure you are connected in the database with Local Schema, in my case APEXDEV
Now we have to execute the script user_install.sql, after connected under APEXDEV schema type the
command to execute the script.
@user_install.sql
After successfully executing the above command you will see the below status
Now copy the library file ojdbc6, orai18n from the directory C:\JasperReportsIntegration\lib & paste into
the directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib
Below screen showing files are copying from the source (left) & moving into the destination (right)
Now copy the JasperReportsIntegration.war file from the directory C:\JasperReportsIntegration\webapp
and paste in the directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps as shown
in the below screen.
Now start the service of Apache Tomcat9 as shown in the below screen
After starting the service of Apache Tomcat you will see there is a new folder JasperReportsIntegration has
been created under the directory C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps as
shown in the below screen
Now edit the file conext.xml under the directory C:\Program Files\Apache Software Foundation\Tomcat
9.0\webapps\JasperReportsIntegration\META-INF
Open the context.xml file with any editor like notepad/notepad++/word pad etc. in the content you will find
a url as shown below.
url="jdbc:oracle:thin:@localhost:1521:DEV"
In the URL text : localhost = the host name, 1521 = Database port, DEV = Oracle DB Service Name
After editing the context.xml file, do not forget to save the content.
Now open a browser window and type the link http://192.168.2.116:8181/manager (from remote/local
machine) or http://localhost:8181/manager (from local machine)
You will see the home page of Apache Tomcat and the /JasperReportsIntegration has been added in the
application list and the running status is showing true.
Now click the /JasperReportsIntegration link from the above screen and you will be redirected to the sample
report page as shown below
Now click the show report button (Senden), you will see the PDF report on screen as shown below
If you see the below screen, it means you have successfully Integrated JasperReport integrated.
Step : 10 Run a Report from Oracle Apex instance and test the JasperReport Integration
Process Details
After logging into Apex admin, click the Create Workspace> button and the new workspace creation page
will be appeared as shown below:
I have given Workspace name “ JASPERREPORTS ” you can input your own preferred name. click Next>
button
Re-use existing schema? = Yes, I have selected the schema = APEXDEV
Remember you should select schema those are granted & configured for required role of JasperReport
Integraton that we have done in the JasperReport Integration part.
In this tutorial I had created APEXDEV schema and assigned those required role to that schema that’s why I
have selected APEXDEV schema as shown below
Click Next> button, in the new screen type your desired user name and password and finally create the
workspace
Once the confirmation shown the workspace is created successfully then click “Done “button.
Now sign-out and sign in to the JASPERREPORTS workspace
Now put the credential as below:
At the first login you will be asked to reset the password, put the old password and reset the password
Now click Apply Changes and you will be directed to the Apex home page
Now click Application Builder then Import button
In the import screen browse to select the example application provided by the JasperSoft to launch report
from Oracle Apex instance & test the integration which you will find in the directory
C:\JasperReportsIntegration\apex
Select the f860_JasperIntegrationTest_1.3.0.2.sql and click Open button, then click Next> button
File import confirmation page showing. Now click Next> button
Now selection summary page is showing, keep all the setting as it is, click Install Application button
Follow the screen instruction and finally you will get the below screen
Click the Run Application button, you will see the home page of the example report testing page
Please do not click any of the Tab/link in the application as shown above until you map the Apex Report
connection configuration with the configuration that we have done during JasperReport integration &
configuration steps.
Now click the Application 101 button from the application tool bar that you will find at the bottom of the
page as shown in the screen below:
New page appeared, Now click shared components button at the top-right of the page
Now application details page appeared, now go at the bottom of the page and locate Substitutions section
As shown below screen
Change the substitution value of the parameter ‘G_REPORT_URL’ as shown in the figure
Change Localhost to 192.168.2.116 (put your own IP)
Change Port 8080 to 8181 (put your port that you configured)
Click “Apply Changes” and now run the application
When you run the application, home page is appeared. Click the Tab Report Tester and you will see the repot
page showing.
You will notice the Report URL link text has been changed automatically based on the configuration in the
shared components > Application definition we have configured in the earlier step.
Now click “Show Report” button, you will see the pdf report is appeared, you have seen this report earlier,
but this time you are invoking this report from Oracle Apex instance.