PL/SQL Server Pages (PSP)
PL/SQL Server Pages (PSP) are an extension of the PL/SQL Web Toolkit, which allows PL/SQL to be used as a scripting language within HTML files, like ASP, JSP & PHP. The files containing the PL/SQL scripting are loaded and published from within the Oracle8i or Oracle9i database server. This article assumes the default installation of the HTTP server has taken place and the HTTP server is running.Database Access Descriptor Configuration (DAD)
First we must set up a Database Access Descriptor (DAD) to allow the webserver to connect to the database when a specific URL is requested:- Access the database HTTP server main page via a browser (http://yourServer:7778/).
- Click on the "Mod_plsql Configuration Menu" link.
- Click on the "Gateway Database Access Descriptor Settings" link.
- Click on the "Add Default (blank configuration)" link.
- Enter SCOTT as the Database Access Descriptor Name. This will be used in the requesting URL.
- Enter the username (SCOTT), password (TIGER) and connect string (W2K1) for the desired database connection.
- Select the "Basic" authentication mode.
- Click the OK button at the top right of the screen.
Load PSP Files
Next we load the PSP files that will actually produce the web pages. These should be loaded into, or accessable from, the SCOTT schema since this is where the DAD points to:dept_insert_req.psp (Right-click and select "Save Target As...")
dept_insert_act.psp (Right-click and select "Save Target As...")
Since this code contains fragments of HTML it may look rather odd when displayed by the browser. Either view the source or save the source to a file to read the code.
Once the files are saved to the filesystem they can be loaded to the server from the command line using the
loadpsp utility:During the load process each file is converted to a stored procedure which use the PL/SQL Web Toolkit routines. The name of the stored procedure is determined by a page directive:C:\>loadpsp -replace -user scott/tiger@W2K1 dept_insert_req.psp dept_insert_act.psp "dept_insert_req.psp": procedure "dept_insert_req" created. "dept_insert_act.psp": procedure "dept_insert_act" created. C:\>
Any parameters passed to the PSP file must be declared before use:<%@ plsql procedure="dept_insert_act" %>
Each page is stored as a separate procedure, rather than a packaged procedure.<%@ plsql parameter="p_deptno" type="NUMBER" default="NULL" %>
Test It
Once the DAD is configured and the PSP pages are loaded into the SCOTT schema we can test them by opening a browser and requesting the following address, where "yourServer" is the name of the Oracle server:http://yourServer:7778/pls/SCOTT/dept_insert_reqEnter some values into the form and press the submit button. The resulting page should show a successful completion message or an error message. In addition the contents of the
DEPT table are displayed as an HTML table.For further informationn see:
- PL/SQL Web Toolkit
- Java Server Pages
- Developing Web Applications with PL/SQL
- Oracle9i Application Server PL/SQL Web Toolkit Reference
Back to the Top.
