Search code examples
oracleapplication-serveroracleformsoraclereports

Get Oracle application server address


In Oracle Forms and Reports, is there existing any function or procedure or possibility to get application server's address.

For example:

http://hostname:portno/servlet/RWServletserver=repserver+report=ReportName+destype=cache+userid=ConnectString+desformat=htmlcss

And I want to get this part: http://hostname:portno

Or Maybe there is possibility to create link of application in other way, not by knowing address of application server?

The link is to the Excel file which is created by report. The link in top is just an example and it is not link to the file. the path to the file is known.


Solution

  • I have a partial solution for you - the following piece of Forms PL/SQL code will return the IP address of the application server :-

    declare
      v_ip_address   varchar2(20);
      --
    begin
      select SYS_CONTEXT('USERENV','IP_ADDRESS') into v_ip_address from dual;
      --
    end;
    

    The caveat to this functionality is that the Form / Report must be connected to a database to use this, as it uses a database function. However, it will always return the IP address of the application server, not the database server; and has been tested where these are on different boxes.

    SYS_CONTEXT is an Oracle database function (confirmed available in 9i, 10g and 11g) which returns the value of a parameter associated with the context namespace; it comes with a built-in namespace USERENV. This namespace has a number of interesting and useful parameters; see http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions165.htm#g1513460 for details.

    The specific parameter being used here - IP_ADDRESS - returns the IP address of the connected client, which from the database's point of view is the application server, as this is where the Form / Report is actually executing - so you get what you need :) This should work for Reports as well as Forms, although I have not tested this.

    I can't see a way of getting the port number, I'm afraid - but hopefully the above should help you.

    Cheers,

    Keith