8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux
PL/SQL Server Pages
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 Oracle 8i or Oracle 9i 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.
The list of DADs will now contain the SCOTT entry, which can be edited if necessary by clicking the edit icon next to it.
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.
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:\>
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.
<%@ plsql procedure="dept_insert_act" %>
Any parameters passed to the PSP file must be declared before use.
<%@ plsql parameter="p_deptno" type="NUMBER" default="NULL" %>
Each page is stored as a separate procedure, rather than a packaged procedure.
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_req
Enter 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 more informationn see:
- PL/SQL Web Toolkit
- Java Server Pages
- Developing PL/SQL Web Applications
- Developing PL/SQL Server Pages (PSP)
Hope this helps. Regards Tim...