Execute procedure Oracle XE (PL/SQL Server Page a.k PSP) on WebBrowser with WebServer Apache

Requirement :

  • Oracle XE (Oracle Database 11g Express Edition, Installed)
  • User and Database (ex: user/password : coba/system, db:coba)
  • WebServer Apahce (ex all in one : XAMPP, Apache v2.0, Installed)

http://www.apachefriends.org/en/xampp-windows.html

  • Module Apache : mod_owa (For Apache v2.2)

http://oss.oracle.com/projects/mod_owa/dist/documentation/modowa.htm

  • Testing OS : Windows XP
  • Localhost = cybercatzone

Setting Apache :

  • Copy File mod_owa.dll ke folder module apahce (ex: E:\xampp_new\apache\modules)
  • Load module tersebut dengan edit file httpd.conf (ex: E:\xampp_new\apache\conf\httpd.conf)

#Load Oracle Modul

LoadModule owa_module modules/mod_owa.dll

  • Tambahkan setting sebagai lokasi virtual dan sekaligus parameter koneksi ke Oracle ( ex nama lokasi virtual : coba_ora, sehingga pemanggilan dengan root address : http://cybercatzone/coba_ora/ )

#Setting Oracle OWA

<Location /coba_ora>

AllowOverride  None

Options        None

SetHandler     owa_handler

OwaUserid      coba/simple

OwaNLS         WE8ISO8859P1

OwaDiag        COMMAND ARGS CGIENV POOL SQL MEMORY

OwaLog         “logs/mod_owa.log”

OwaPool        20

#OwaStart       “doc_pkg.homepage”

#OwaDocProc     “doc_pkg.readfile”

OwaDocPath     docs

OwaUploadMax   10M

OwaCharset     “iso-8859-1”

order          deny,allow

allow          from all

</Location>

  • Start Apache (jika sudah kondisi Start,  Restart)
  • Pastikan Status Apache adalah Running 😉

Testing :

  • Buat procedure (ex: test_page)

–       Bisa dari command line atau via SQL Commands dari WebAPP

CREATE OR REPLACE PROCEDURE test_page IS

CURSOR get_data IS

SELECT INITCAP(LOWER(object_type)) type, COUNT(*) count

FROM all_objects

GROUP BY object_type;

BEGIN

htp.p(‘<table border=”1″>’);

htp.p(‘<tr><th>Type:</th><th>Count:</th></tr>’);

FOR i IN get_data LOOP

htp.p(‘<tr><td>’||i.type||'</td><td>’||i.count||'</td></tr>’);

END LOOP;

htp.p(‘</table>’);

END test_page;

 

  • Jalankan procedure via WebBrowser

Ketikan pada address WebBrowser:

http://cybercatzone/coba_ora/test_page

 

reff :

http://www.joelennon.ie

versi pdf bisa didownload : link

Leave a Reply

Your email address will not be published. Required fields are marked *