Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle as HTTP server?
It's a not very hard for any version of Oracle 7+ - provided you have a
working version of the PL/SQL cartridge.
Some hints from my experience:
Here's a segment sample - don't try to compile as it's roughly pasted.
http://yourserver:#port#/your_package.get_music?music_id=[primary_key]
PROCEDURE get_music (music_id number) AS
Lob_field BLOB;
buffer RAW(32767);
offset BINARY_INTEGER:=1;
buffer_size NUMBER:=32767; --- adjust to your application
nImageId NUMBER := music_id;
BEGIN
-- retrieve the LOB locator into the PL/SQL locator variable lob_field
SELECT music_image
INTO lob_field FROM music_image c
OWA_UTIL.MIME_HEADER('image/mp3');
-- read the LOB content in a loop and send it across to the browser
LOOP
DBMS_LOB.READ(lob_field,buffer_size,offset,buffer);
-- convert the raw content read into varchar2 and send it to the browser
htp.prn(UTL_RAW.CAST_TO_VARCHAR2(buffer)); htp.prn(buffer); offset:=offset+buffer_size;
-- Catch the no_data_found exception.This is raised by the dbms_lob.read -- procedure -- when the end of the LOB is reached and there are no more bytes to readEXCEPTION
Eric
Joost Mulders wrote in message <3BD592AE.3F252C65_at_j-mulders.demon.nl>...
>Hi,
>
>I have an 8.1.5 database with a bunch of mp3's in BLOBS. Is there an easy
way to give access to the files via HTTP for personal use, i.e. Oracle as a
webserver?
>
>I am simple and I want to be able to execute simple commands like "mpg123
"http://oracle_database_server/mp3file.mp3"
>
>Is this possible?, where to start looking ?
>
>Thanks !
>
>Joost
Received on Mon Oct 29 2001 - 00:36:31 CST
![]() |
![]() |