Installing Oracle Application
Express (Apex) with Apache Tomcat 7.0
•
Download the following Applications
• Oracle Database
• Oracle Application
Express
• Oracle Restful Data
Services (Previously known as Apex Listener)
• Apache Tomcat
•
Unzip the downloaded oracle database zip files in a single folder only. I have downloaded Oracle Database 11g
•
Unzip other downloaded software in a different folder.
Installing Oracle Database
•
Install Oracle Standard Database.
Open the Oracle DB unzip folder and click the 'Setup.exe' file start to install the Oracle Database.
Once the database installation over, Be default Oracle Apex Version 3.0 also installed together.
Login with sql*plus
SQL> select version from dba_registry where comp_id='APEX';
VERSION
------------------------------
3.2.1.00.10
In case if you
want to install the latest version of Apex then you must remove the existing oracle apex. Find the path of installed oracle db, similar like below and run the following command
SQL>
@D:\app\ajabbar\product\11.2.0\dbhome_1\apex\apxremov.sql
this command will
remove the existing apex.
To confirm the Apex availability, run the below command.
SQL> select
version from dba_registry where comp_id='APEX';
No rows selected.
Install Oracle Apex
. Open the command prompt (DOS) by following, Goto Run-> cmd
to open a dos prompt window
• d:\>apex_4.2.6\apex
• Connect SQL*plus with sys account
• d:\>apex_4.2.6\apex\sqlplus / as sysdba
• SQL>
• Create Table space
• Connect SQL*plus with sys account
• d:\>apex_4.2.6\apex\sqlplus / as sysdba
• SQL>
• Create Table space
SQL>CREATE
TABLESPACE APEX_SPACE datafile
'D:\app\ajabbar\oradata\orcl\APEX_SPACE.DBF'
SIZE
500M
EXTENT
MANAGEMENT LOCAL
SEGMENT
SPACE MANAGEMENT AUTO;
Tablespace
created.
• Install the oracle
apex
SQL> @apexins APEX_SPACE
APEX_SPACE TEMP /i/
• Once installation
over, then Change the Password for the ADMIN Account
SQL> @apxchpwd.sql
• Now load the
necessary images into Database
SQL >
@apxldimg.sql
Now you
will be asked to enter the value for 1 :
Simple type
below :
D:/apex_4.2.1 (PLEASE NOTE THAT
I HAVE USED ‘/’ INSTEAD OF ‘\’)
And press
Enter and the image loading will be started.
• unlock the
apex_public_user account
SQL> ALTER USER
APEX_PUBLIC_USER ACCOUNT UNLOCK
• Change the password
for Apex_public_user
SQL> ALTER USER APEX_PUBLIC_USER
IDENTIFIED BY ......
• Disable the
existing XML DB Port
SQL> EXEC
DBMS_XDB.SETHTTPPORT(0);
• now Configure
RESTful Services:
SQL> @apex_rest_config.sql
Now set the password for
Apex_LISTERNER….
• Also execute the
below Procedure for make the Granting Connect Privileges to Host
DECLARE
ACL_PATH VARCHAR2(4000);
BEGIN
-- Look for the ACL currently
assigned to '*' and give APEX_040200
-- the "connect"
privilege if APEX_040200 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM
DBA_NETWORK_ACLS
WHERE HOST = '*' AND
LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
IF
DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040200',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_040200', TRUE,
'connect');
END IF;
EXCEPTION
-- When no ACL has been
assigned to '*'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
'ACL that lets power users
to connect to everywhere',
'APEX_040200', TRUE,
'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;
• Granting Connect
Privileges to Localhost
DECLARE
ACL_PATH VARCHAR2(4000);
BEGIN
-- Look
for the ACL currently assigned to 'localhost' and give APEX_040200
-- the
"connect" privilege if APEX_040200 does not have the privilege yet.
SELECT
ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = 'localhost' AND LOWER_PORT IS
NULL AND UPPER_PORT IS NULL;
IF
DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040200',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_040200', TRUE, 'connect');
END IF;
EXCEPTION
-- When
no ACL has been assigned to 'localhost'.
WHEN
NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('local-access-users.xml',
'ACL
that lets users to connect to localhost',
'APEX_040200',
TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('local-access-users.xml','localhost');
END;
/
COMMIT;
• Now unlock and
change the Password for below schemas:
SQL>select
username,account_status from dba_users;
APEX_LISTENER
APEX_PUBLIC_USER
HR
APEX_REST_PUBLIC_USER
FLOWS_FILES
APEX_040200
SQL> alter user
HR ACCOUNT UNLOCK;
User altered.
SQL> alter user
HR identified by HR;
User altered.
Install Oracle Restful Data Service (ORDS)
• Locate/open the
where the Oracle Restful Data Service (ords.2.0.9.224.01.05 ) is unzipped.
• D:\ords.2.0.9.224.01.05
Configure the ORDS
for Apache
D:\ords.2.0.9.224.01.25\java
–jar ords.war
This Oracle REST
Data Services instance has not yet been configured.
Please complete the
following prompts
Enter the location
to store configuration data:D:\ORDS.2.0.9.224.01.05
Oct 15, 2014
2:26:17 PM oracle.dbtools.common.config.cmds.ConfigDir execute
INFO: Set
config.dir to D:\ORDS.2.0.9.224.01.05 in: D:\ORDS.2.0.9.224.01.05\ords.war
Oct 15,
2014 2:26:19 PM oracle.dbtools.common.config.file.ConfigurationFolder
logConfigFolder
INFO: Using
configuration folder: D:\ORDS.2.0.9.224.01.05\ords
Enter the name of
the database server [localhost]:GCCSAUPD.gcc.local
Enter the database
listen port [1521]:1521
Enter 1 to specify
the database service name, or 2 to specify the database SID [
1]:1
Enter the database
service name:orcl
Enter the database
user name [APEX_PUBLIC_USER]:
Enter the database
password for APEX_PUBLIC_USER:
Confirm password:
Enter 1 to enter
passwords for the RESTful Services database users (APEX_LISTENE
R,APEX_REST_PUBLIC_USER),
2 to use the same password as used for APEX_PUBLIC_USE
R or, 3 to skip
this step [1]:2
Oct 15, 2014
2:31:07 PM oracle.dbtools.common.config.file.ConfigurationFiles upd
ate
INFO: Updated
configurations: defaults, apex, apex_al, apex_rt
Enter 1 if you wish
to start in standalone mode or 2 to exit [1]:2
Configure Oracle Restful Data Service (ORDS) with
Apache Tomcat
• Install the Apache
Tomcat, define http port other than 8080
• Once the Apache
tomcat installed successfully then, Now copy the ords.war file from 'D:\ords.2.0.9.224.01.05' folder and paste into
webapps folder where apache tomcat installed.
C:\Program Files\Apache Software Foundation\Tomcat
7.0\webapps
• Copy apex images
folder into webapps folder in Apache tomcat and change the directory name to i.
D:\Apex_4.2.6\apex\images ---> C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\i
Now open the browser and enter the link as following:
http://localhost:8082/ords
Sure it will open the Oracle Apex. (If you follow the instructions as mentioned here)
ERROR
======
In some moment when you made web service through ORDS and while testing, you may get the below error,
503 -
Service Unavailable
tomcat log file:
Jan 22, 2013
2:48:16 PM oracle.dbtools.common.jdbc.ora.OraPrincipal connection
SEVERE: The
database user configured in the connection pool named: apex_rt is not
authorized to proxy to the database user: TEST
Where this error?
You have to grant
access to the schema for the REST user (as SYS):
alter user TEST
grant connect through APEX_REST_PUBLIC_USER;
Thanking you.