Home » Fusion Middleware & Colab Suite » Weblogic & Application Server » saving client IP,Host name,User id in AS enviornment
saving client IP,Host name,User id in AS enviornment [message #278840] Mon, 05 November 2007 22:24 Go to next message
jamalmustafa
Messages: 3
Registered: November 2007
Location: pakistan
Junior Member
hi,

I was using "SYS_CONTEXT" builtin package to store client IP & hostname in client server enviornment.
===============================================
e.g FUNCTION RETURN_HOST_NAME
RETURN VARCHAR2
IS
HOST_NAME_V VARCHAR2(100);
BEGIN
SELECT SYS_CONTEXT('USERENV','TERMINAL')
INTO HOST_NAME_V
FROM DUAL;
RETURN(HOST_NAME_V);
END;
================================================
Now in Application server Env i am unable to utalize this package as it is storing application server Host_name and IP Address
but I want to store clients Host_name and IP Address
in local area network.
Please do the needful asap.

Regards,
Jamal
Re: saving client IP,Host name,User id in AS enviornment [message #279024 is a reply to message #278840] Tue, 06 November 2007 11:44 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
On the Application Server grab the Browser's IP# & save it using dbms_application_info
Re: saving client IP,Host name,User id in AS enviornment [message #279095 is a reply to message #279024] Tue, 06 November 2007 21:36 Go to previous messageGo to next message
jamalmustafa
Messages: 3
Registered: November 2007
Location: pakistan
Junior Member
hi,

please breif a bit more.any example may help.

regards,
jamal
Re: saving client IP,Host name,User id in AS enviornment [message #279107 is a reply to message #278840] Tue, 06 November 2007 23:13 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Apache creates an environmental variable which contains the IP# of the browser client. The Application Server is programmed to obtain the client IP# & then calls DBMS_APPLICATION_INFO to deposit the IP# into CLIENT_INFO which can be read from V$SESSION
Re: saving client IP,Host name,User id in AS enviornment [message #279334 is a reply to message #279107] Wed, 07 November 2007 18:46 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
If you are using MOD_PLSQL to access Oracle from iAS, "all" the required Apache & browser variables are already available in OWA_UTIL pkg. You can't call OWA_UTIL unless your request comes in from MOD_PLSQL due to a "bug" - you'll get an ORA-06502: PL/SQL: numeric or value error



         IF OWA.num_cgi_vars IS NOT NULL
         THEN
            -- PL/SQL gateway connection (WEB client)
            v_ip := OWA_UTIL.get_cgi_env ('REMOTE_ADDR');
         ELSE
            -- Direct connection over tcp/ip network
            v_ip := SYS_CONTEXT ('USERENV', 'IP_ADDRESS');
         END IF;



The list of vaiables available varies by release so this may be out of date:
HTTP_AUTHORIZATION
DAD_NAME
DOC_ACCESS_PATH
HTTP_ACCEPT
HTTP_ACCEPT_CHARSET
HTTP_ACCEPT_LANGUAGE
HTTP_COOKIE
HTTP_HOST
HTTP_PRAGMA
HTTP_REFERER
HTTP_USER_AGENT
PATH_ALIAS
PATH_INFO
HTTP_ORACLE_ECID
DOCUMENT_TABLE
REMOTE_ADDR
REMOTE_HOST
REMOTE_USER
REQUEST_CHARSET
REQUEST_IANA_CHARSET
REQUEST_METHOD
REQUEST_PROTOCOL
SCRIPT_NAME
SCRIPT_PREFIX
SERVER_NAME
SERVER_PORT
SERVER_PROTOCOL

CREATE OR REPLACE PROCEDURE env
AS
BEGIN
   HTP.htmlOpen;
      HTP.headOpen;
         HTP.title ('Environment Test');
      HTP.headClose;
      HTP.bodyOpen;
         HTP.hr;
         HTP.br;
         HTP.p ('REMOTE_ADDR=' || OWA_UTIL.get_cgi_env ('REMOTE_ADDR'));
         HTP.br;
         HTP.p ('REMOTE_USER=' || OWA_UTIL.get_cgi_env ('REMOTE_USER'));
         HTP.br;
         HTP.p ('HTTP_HOST=' || OWA_UTIL.get_cgi_env ('HTTP_HOST'));
         HTP.br;
         HTP.p ('SERVER_NAME=' || OWA_UTIL.get_cgi_env ('SERVER_NAME'));
         HTP.br;
         HTP.p ('SERVER_PORT=' || OWA_UTIL.get_cgi_env ('SERVER_PORT'));
         HTP.br;
         HTP.p ('<H1>All CGI Environment variables...</H1>');
         OWA_UTIL.print_cgi_env;
      HTP.bodyClose;
   HTP.htmlClose;
END;


See http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:500221786045

[Updated on: Wed, 07 November 2007 18:54]

Report message to a moderator

Previous Topic: FRM-92101
Next Topic: Application Server Configuration
Goto Forum:
  


Current Time: Tue Mar 19 03:54:24 CDT 2024