Custom Search

Wednesday, March 23, 2016

Time Out Oracle Form when idle for a long time

(1.) Download timeout.jar
(2.) Put it into ORACLE_HOME\forms\java folder.
(3.) Add entry of the jar to formsweb.cfg
-- archive_jini=frmall_jinit.jar,timeout.jar
-- archive=frmall.jar,timeout.jar
(4.) Open the form and in Form builder.
(5.) Create block called PJC 
(6.) Add Bean and name it TIMEOUT and make the Implementation Class oracle.forms.demos.TimeoutPJC
(7.) For the bean create a WHEN-CUSTOME-ITEM-EVEN trigger and put this code
DECLARE
     eventName                varchar2(30) := :system.custom_item_event;
     v_alert_answer      varchar2(1);
BEGIN
     IF (eventName='MAX_INACTIVITY_EXCEEDED') THEN
          --FORMS_DDL('ROLLBACK');
          message('Oracle Forms Session is timeout'); PAUSE;
          message('about to disconnect with DB'); pause;
          LOGOUT;
  END IF;
END;
DECLARE
      v_expiry_time      VARCHAR2(10) := '1'; --settintg timer this should be roud of value
     v_debug_yn                VARCHAR2(10) := 'true'; -- enabling debug message this u can set false also if u dont want debug message in java console
     args                               Varchar2(400);
     args_has_value      boolean := false;

BEGIN
          
     ----------------Timeout---
     IF v_expiry_time IS NOT NULL THEN
          args := args||'all'; -- this you change based on what event u want
          args_has_value:=true;

          IF (args_has_value) THEN
          -- Set custom Bean property
          set_custom_property('PJC.TIMEOUT',1,'RECORDING_EVENTS',args);
          END IF;

          set_custom_property('PJC.TIMEOUT',1,'ENABLE_DEBUGGING',v_debug_yn);
          set_custom_property('PJC.TIMEOUT',1,'TIMER_SLEEP_TIME','10');
          set_custom_property('PJC.TIMEOUT',1,'START_TIMER',v_expiry_time);
          
          -------
          END IF;

END;

No comments:

Post a Comment