Bypass Username and password in Oracle Report URL.

If you do not want to show the user name and password in the report url calling from oracle forms. You must create a CMDkey :

C:\DevSuiteHome_1\reports\conf\rwservlet.properties

change the following parameters to YES:

SERVER_IN_PROCESS=YES
RELOAD_KEYMAP=YES

Now Go to :

C:\DevSuiteHome_1\reports\conf\cgicmd.dat

Add this line at the bottom:

lierp: Userid=U00001/U@RPRT%*

where :

CMDKEYNAME = lierp
UserID = U00001
Password = U
Connect String = RPRT

Now create the following table :

CREATE TABLE REPPARA
(
ID          NUMBER(10),
IP          VARCHAR2(30),
PORT        VARCHAR2(30),
URL         VARCHAR2(30),
CMDKEY      VARCHAR2(30),
DESFORMAT   VARCHAR2(30),
DESTYPE     VARCHAR2(30)
);

ALTER TABLE REPPARA ADD CONSTRAINT PK_REPPARA_ID PRIMARY KEY (ID);

INSERT INTO REPPARA VALUES (1,'192.168.1.30','8889','/reports/rwservlet','lierp','pdf','cache');
INSERT INTO REPPARA VALUES (2,'192.168.1.30','8889','/reports/rwservlet','lierp','htmlcss','cache');
INSERT INTO REPPARA VALUES (3,'192.168.1.30','8889','/reports/rwservlet','lierp','spreadsheet','cache');

192.168.1.30 is the IP address.
8889 is the Port Number
/reports/rwservlet     is the report URL
lierp  ---- It is the name of Connect String.

Now grant permission of the tale reppara :

grant select on reppara to roprtr;

Run the following Function in Forms:

FUNCTION       F_PRINT_PARA
               (
                vid          number,
                vPath        varchar2,
                vReportNM    varchar2,
                vParamForm   varchar2
               )
  RETURN VARCHAR2
IS
  rep_url      varchar2(2000);
  vIP          VARCHAR2(30);
  vPORT        VARCHAR2(30);
  vURL         VARCHAR2(30);
  vCMDKEY      VARCHAR2(30);
  vDESFORMAT   VARCHAR2(30);
  vDESTYPE     VARCHAR2(30);
  cursor       c_reppara is
  select       IP,PORT,URL,CMDKEY,DESFORMAT,DESTYPE
  from         lierp.reppara
  where        id=vid;
  r_reppara    c_reppara%rowtype;
BEGIN
  open c_reppara;
  fetch c_reppara into vip,vport,vurl,vcmdkey,vdesformat,vdestype;
  close c_reppara;
  IF VIP IS NOT NULL THEN
    rep_url:='http://'||VIP||':'||VPORT||VURL||'?cmdkey='||VCMDKEY||'&report='||VPATH||VREPORTNM||'&desformat='||VDESFORMAT||'&destype='||VDESTYPE||'&paramform='||VPARAMFORM;
  ELSE
  rep_url:='';
  END IF;
  RETURN REP_URL;
END;

Now call the report :

PARAMETER LESS REPORT :

DECLARE
  rep_url varchar2(2000);
  vDB     varchar2(10);
BEGIN
  rep_url:=f_print_para(:GLOBAL.PRINTID,:global.path,'PROJECT_LIST.rep','no');
  WEB.SHOW_DOCUMENT(rep_url,'_blank');
END;

Call report with parameter FROM WEB.

DECLARE
  rep_url varchar2(2000);
  vDB     varchar2(10);
BEGIN
  rep_url:=f_print_para(:GLOBAL.PRINTID,:global.path,'rate.rep','yes');
  WEB.SHOW_DOCUMENT(rep_url,'_blank');
END;

Call report with parameter from FORM;

DECLARE
  rep_url varchar2(2000);
  vDB     varchar2(10);
BEGIN
  rep_url:=f_print_para(:GLOBAL.PRINTID,:global.path,'rate.rep','no')||'&p_plan='||:plan||'&p_term='||:term;
  WEB.SHOW_DOCUMENT(rep_url,'_blank');
END;

Very simple! Isn't It?

Muhammad Abdullah Al Noor.


Muhammad Abdullah Al Noor

Muhammad Abdullah Al Noor, An Oracle Apex Consultants and founder of Noors Technology (www.noorstech.com). Core Expertise : Database Administration, Oracle Forms and Reports Development, Oracle Apex Application Designer and Development, Linux Professional etc. Also the owner of TrainerBD Training and OraDemy E-Learning. WhatsApp +8801790721177

Post a Comment

Previous Post Next Post