How to obtain local IP address of PC within Oracle ApEx

11,428

To obtain the Oracle Client IP address you have to use the one you suggested::

select sys_context('userenv','ip_address') 
  from dual;

To obtain the Oracle Server IP address you can use:

select utl_inaddr.get_host_address(sys_context('userenv','server_host')) 
  from dual;

UPDATE (from comment): If you are looking for the application server IP, nor client nor server. Right? This cannot be obtained by oracle. This is like asking oracle the web server IP. As Oracle Appex is 100% PLSQL you cannot obtain this information.

Share:
11,428
tonyf
Author by

tonyf

Updated on September 15, 2022

Comments

  • tonyf
    tonyf over 1 year

    I need a means of obtaining the local IP Address (Windows box listed in ipconfig command info) from within Oracle ApEx.

    Is this possible? I have tried both owa_util.get_cgi_env('REMOTE_ADDR') as well as sys_context( 'userenv', 'ip_address' )

    Just can't seem to get my local PC IP address within Oracle ApEx.

    Any ideas?

  • tonyf
    tonyf over 14 years
    Thanks for getting back to me. Unfortunately I have tried both of these methods but to no avail. The way the database is setup here is via a Load Balancer to determine within app server a user will connect to. I think this setup is posing a problem.
  • Omid
    Omid over 14 years
    You are looking for the application server IP?
  • tonyf
    tonyf over 14 years
    I am actually looking for the local PC IP on a Windows box. If you go into command window in windows and issue a ipconfig, you will see an IP Address value. It's this value I need to get to within Oracle.