PHP with Oracle AQ

Using PHP with Oracle Advanced Queues

This tutorial shows you how to use PHP with Oracle Streams Advanced Queuing (AQ) to implement message queuing functionality on you web applications. You will also learn the basics of PHP-Oracle integration such as how to connect to an Oracle Database from PHP, execute SQL and PL/SQL statements, binding PHP variables to SQL placeholders and displaying query results on a web page.

This tutorial uses a hypothetical use-case scenario of an “Employee Salary Review Process” and guides you through the implementation of this use case using PHP with Oracle.

Purpose: "Employee Salary Review"

Summary: An employee's line manager uses the "Salary Review Form" web page to input an employee id and the percentage of increment to offer and submits the form to HR department.
The HR department access the "Salary Review Approval" web page which shows the salary reviews that are pending approval, one at a time.
HR personnel can either approve a review or reject and get the next pending review.
If a review is approved then the salary for that employee must be updated in the database. No action is needed if the review is rejected.

Implementation Details

We need two web pages – Salary Review Form and Review Approval Form. We will create both the pages in PHP with HTML5 and basic CSS styling.

In the Oracle database we have the Employees table which contains employee details such as Employee id, Name, salary etc.. This tutorial uses the Oracle sample schema "HR" which contains the Employees table. If you do not already have the sample schema installed, then we will show you how to create the Employees table manually later in the tutorial.

We will also create an Oracle Advanced Queue (AQ) and the necessary PL/SQL procedures to enqueue and dequeue the messages.
When the user submits the Salary Review form, a message is added to the AQ. The message will have the employee id and the increment percentage.
When the user submits the Salary Review form, a message is added to the AQ. The message will have the employee id and the increment percentage.
The approval form will dequeue the message from the AQ and using the employee id, gets the employee details from Employees Table.
If the Increment is approved then the Employees table will be updated with the new salary.
If the increment is rejected then the next message is fetched from the AQ.

PHP with Oracle AQ

Post a comment

Name

Your Comment

Email (We dont publish it)

Comments

Nothing yet..be the first to share wisdom.