Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Why can not I get user's IP using owa_sec.get_client_ip?
Hello :
I am using Oracle web server 3.0 and oracle 7.3.3 to develop a web based administration system
I am now facing such a problem: in my program which deal with the user request , want to record where the request comes , so I use the procedure owa_sec.get_client.ip to get the ip address of user . but I found that :
The sequence is like the following:
client_ip := owa_sec.get_client_ip ;
ipaddr := to_char(client_ip(1)) || '.' || to_char(client_ip(2)) || '.' || to_char(client_ip(3)) || '.' || to_char(client_ip(4)) ;
select ... for update ; <--- will always succeed
if ... then
update ..... (record the client ip address)
end if ;
2. If I use the function after all the update operation of tranction , the transaction will be done twice . all destruct the data consistence.
Like the following:
select .. for update;
if ... then
update .... update .... ( not record the client ip address)
end if ;
commit;
client_ip := owa_sec.get_client_ip ;
ipaddr := to_char(client_ip(1)) || '.' || to_char(client_ip(2)) || '.' || to_char(client_ip(3)) || '.' || to_char(client_ip(4)) ; update .... ( record the ip address ) <-- will cause the transaction redo from the begining 3. if I use the function before any database operation , which form a user interface form client_ip := owa_sec.get_client_ip ; ipaddr := to_char(client_ip(1)) || '.' || to_char(client_ip(2)) || '.' || to_char(client_ip(3)) || '.' || to_char(client_ip(4)) ; htp.print... < form a html page> the system shows :
Request Failed
>Error occured while accessing
"/work/plsql/upd163.pasproc"
at Sun Mar 29 13:44:21 1998
OWS-05101: Execution failed due to Oracle error 1403 ORA-01403: no data found ORA-06512: at "SJ.UPD163", line 766 ORA-06512: at line 1
PL/SQL Cartridge SERVICE: work
PROCEDURE: upd163.pasproc
PARAMETERS:
Why ? How can I do with the problem ?
Each word will be highly appriciated !
Jing Shen
mail to: sj_at_china.pages.com.cn
-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Sun Mar 29 1998 - 00:00:00 CST