2

在 Oracle Forms and Reports 中,是否存在获取应用服务器地址的任何函数或过程或可能性。

例如:

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

我想得到这部分:http://hostname:portno

或者也许有可能以其他方式创建应用程序链接,而不是通过知道应用程序服务器的地址?

该链接指向由报表创建的 Excel 文件。顶部的链接只是一个示例,它不是文件的链接。文件的路径是已知的。

4

1 回答 1

1

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

于 2013-04-30T13:03:10.897 回答