Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Getting IP address of client

Re: Getting IP address of client

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 14 Oct 1998 13:27:44 GMT
Message-ID: <362fa670.176775890@192.86.155.100>


A copy of this was sent to p0070621_at_brookes.ac.uk (Tommy Wareing) (if that email address didn't require changing) On Wed, 14 Oct 1998 12:00:34 GMT, you wrote:

>On Mon, 12 Oct 1998 01:03:30 GMT, tkyte_at_us.oracle.com (Thomas Kyte)
>wrote:
>
>>SQL> declare
>> 2 tmp varchar2(15);
>> 3 begin
>> 4 tmp := owa_util.get_cgi_env( 'remote_addr' );
>> 5 end;
>> 6 /
>>declare
>>*
>>ERROR at line 1:
>>ORA-06502: PL/SQL: numeric or value error
>>ORA-06512: at "OWS2.OWA_UTIL", line 160
>>ORA-06512: at line 4
>>
>>
>>You see, owa_util is initialized by the webserver -- if you are not using the
>>webserver then owa_util has NULLS all over it and it will attempt to:
>>
>>....
>> for i in 1 .. NUM_CGI_VARS loop
>> ...
>>
>>but num_cgi_vars is NULL and that throws the exception...
>
>Grrr. Thank you.
>
>I keep trying to log this as a bug, but I get told that you're not
>supposed to run web procedures from within sqlplus, only via the web
>server.
>
>Which of course, means that supplying the owa_util.showpage procedure
>makes no sense at all, since this is supposed to be run after you run
>your web procedure from within sqlplus.
>
>And the fix for this (when they get round to fixing it)?
>Change
>num_cgi_vars number;
>to
>num_cgi_vars number:=0;
>in the package specification for owa.
>(The file is pubowa.sql)

Another way to fix this is not to change the packages but run the startup code as webserver would. for example:

declare

    nm owa.vc_arr;
    vl owa.vc_arr;
begin

    nm(1) := 'FOO';
    vl(1) := 'BAR';
    owa.init_cgi_env( 1, nm, vl );
end;
/
exec owa_util.print_cgi_env

set heading off
set feedback off
set trimspool on
set linesize 255
set serveroutput on size 1000000
spool abc
exec owa_util.showpage
spool off

You should set up the owa.init_cgi_env with a 'real' environment to test your app with. I put a small block like this before I make the call to the webprocedure with the appropriate variables my code is looking for (eg: REMOTE_ADDR, REMOTE_USER and so on) to do testing...  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Wed Oct 14 1998 - 08:27:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US