Connection Handling

Oracle Forms connections are established with OraFormsConnect and are closed with OraFormsDisconnect. Recorded scripts include OraFormsConnect at the beginning of the TMain transaction and OraFormsDisconnect as the last Oracle Forms call in TMain. OraFormsDisconnect must be called to ensure that the server connection is closed, otherwise the server runtime process that handles the client will continue to run.

OraForms.bdh implements event handlers that call OraFormsDisconnect when server errors cause virtual user process exits.

In scenarios in which you have a login procedure and multiple main transactions that perform actions that you want to test, you must ensure that you have established connections at the beginning of transactions. As connections may close due to severe errors, subsequent transactions must re-establish connections.

The suggested means of handling this issue is to create a BDL function that contains the script code that establishes the connection to the Oracle Forms application. The function can use the OraFormsIsConnected method to query if a connection is already established. This function should be called at the beginning of each Oracle Forms transaction that requires a connection to the application.

Example

After recording, your script should resemble the following:
var
  gsSSessionID : string;

dclrand

dcltrans
  transaction TInit
  begin
    OraFormsInit("http://lnz-vmoraf11:8888/forms/lservlet", "lnz-vmoraf11", 9000, ORA_FORMS_11G);
    //WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);
    //WebSetDocumentCache(true, WEB_CACHE_CHECK_SESSION);
  end TInit;

  transaction TShutdown
  begin
    OraFormsDestroy();
  end TShutdown;

  transaction TMain
  begin
    WebSetBrowser(WEB_BROWSER_MSIE8);
    WebModifyHttpHeader("Accept-Language", "de-at");
    WebPageUrl("http://lnz-vmoraf11:8888/forms/frmservlet", "iOrganizer", FORMS_FRMSERVLET001);
 
    WebSetBrowser(WEB_BROWSER_CUSTOM);
    WebSetUserAgent("Java1.6.0.21");
    WebSetHttpVersion("HTTP/1.1");
    WebModifyHttpHeader("Accept-Language", NULL, WEB_MODIFY_ OPT_Remove);
    WebUrl("http://lnz-vmoraf11:8888/forms/java/f90all_ jinit.jar", 29.61);
    WebUrl("http://lnz-vmoraf11:8888/forms/jars/iorganizer.jar", 0.42);
    WebUrl("http://lnz-vmoraf11:8888/forms/iorg_images/iorganizer.gif", 0.45);
    WebUrl("http://lnz-vmoraf11:8888/forms/images/blue.gif", 0.43);
    WebUrl("http://lnz-vmoraf11:8888/forms/java/oracle/forms/registry/Registry.dat", 0.08);
    WebUrl("http://lnz-vmoraf11:8888/forms/iorg_registry/iorg_registry.dat", 6.58);
 
    // Connect - with connection properties
    OraFormsSetInt("INITIAL_VERSION", 1111003);
    OraFormsSetPoint("INITIAL_RESOLUTION", 96, 96);
    OraFormsSetPoint("INITIAL_DISP_SIZE", 1280, 1024);
    OraFormsSetInt("INITIAL_COLOR_DEPTH", 256);
    OraFormsSetString("FONT_NAME", "Dialog");
    OraFormsSetInt("FONT_SIZE", 900);
    OraFormsSetByte("FONT_STYLE", 0);
    OraFormsSetByte("FONT_WEIGHT", 0);
    OraFormsSetPoint("INITIAL_SCALE_INFO", 8, 20);
    OraFormsSetBoolean("WINSYS_REQUIREDVA_LIST", false);
    OraFormsSetString("DEFAULT_LOCAL_TZ", "Europe/Berlin");
    OraFormsConnect("server escapeParams=true module=iorganizer.fmx userid=  debug=no host= port= usesdi=yes record=names", 
      "http://lnz-vmoraf11:8888/forms/lservlet?ifcfs=/forms/frmservlet?config=iorg&ifsessid=formsapp.4&acceptLanguage=de-at", 
      "http://lnz-vmoraf11:8888/forms/frmservlet?config=iorg");
    OraFormsGetSessionId(gsSSessionID);
    WebCookieSet(gsSSessionID, "http://lnz-vmoraf11:8888/forms/java/");
 
    // ---
    // New window activated: 10
    OraFormsSetWindow("10");
    ThinkTime(6.6);

    …
end TMain
After customization, your script should appear as follows:
var
  gsSSessionID : string;

dclfunc
  function DoConnect
  begin
    WebSetBrowser(WEB_BROWSER_MSIE8);
    WebModifyHttpHeader("Accept-Language", "de-at");
    WebPageUrl("http://lnz-vmoraf11:8888/forms/frmservlet", "iOrganizer", FORMS_FRMSERVLET001);
 
    WebSetBrowser(WEB_BROWSER_CUSTOM);
    WebSetUserAgent("Java1.6.0.21");
    WebSetHttpVersion("HTTP/1.1");
    WebModifyHttpHeader("Accept-Language", NULL, WEB_MODIFY_ OPT_Remove);
    WebUrl("http://lnz-vmoraf11:8888/forms/java/f90all_ jinit.jar", 29.61);
    WebUrl("http://lnz-vmoraf11:8888/forms/jars/iorganizer.jar", 0.42);
    WebUrl("http://lnz-vmoraf11:8888/forms/iorg_images/iorganizer.gif", 0.45);
    WebUrl("http://lnz-vmoraf11:8888/forms/images/blue.gif", 0.43);
    WebUrl("http://lnz-vmoraf11:8888/forms/java/oracle/forms/registry/Registry.dat", 0.08);
    WebUrl("http://lnz-vmoraf11:8888/forms/iorg_registry/iorg_registry.dat", 6.58);
 
    // Connect - with connection properties
    OraFormsSetInt("INITIAL_VERSION", 1111003);
    OraFormsSetPoint("INITIAL_RESOLUTION", 96, 96);
    OraFormsSetPoint("INITIAL_DISP_SIZE", 1280, 1024);
    OraFormsSetInt("INITIAL_COLOR_DEPTH", 256);
    OraFormsSetString("FONT_NAME", "Dialog");
    OraFormsSetInt("FONT_SIZE", 900);
    OraFormsSetByte("FONT_STYLE", 0);
    OraFormsSetByte("FONT_WEIGHT", 0);
    OraFormsSetPoint("INITIAL_SCALE_INFO", 8, 20);
    OraFormsSetBoolean("WINSYS_REQUIREDVA_LIST", false);
    OraFormsSetString("DEFAULT_LOCAL_TZ", "Europe/Berlin");
    OraFormsConnect("server escapeParams=true module=iorganizer.fmx userid=  debug=no host= port= usesdi=yes record=names", 
      "http://lnz-vmoraf11:8888/forms/lservlet?ifcfs=/forms/frmservlet?config=iorg&ifsessid=formsapp.4&acceptLanguage=de-at", 
      "http://lnz-vmoraf11:8888/forms/frmservlet?config=iorg");
    OraFormsGetSessionId(gsSSessionID);
    WebCookieSet(gsSSessionID, "http://lnz-vmoraf11:8888/forms/java/");

  end DoConnect;

dcltrans
  transaction TInit
  begin
    OraFormsInit("http://lnz-vmoraf11:8888/forms/lservlet", "lnz-vmoraf11", 9000, ORA_FORMS_11G);
    //WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);
    //WebSetDocumentCache(true, WEB_CACHE_CHECK_SESSION);
  end TInit;

  transaction TShutdown
  begin
    OraFormsDestroy();
  end TShutdown;

  transaction TMain
  begin
    DoConnect();

    // ---
    // New window activated: 10
    OraFormsSetWindow("10");
    ThinkTime(6.6);
    …
  end Tmain

  transaction TsecondMain
  begin
    DoConnect();

    // ---
    // New window activated: 10
    OraFormsSetWindow("10");
    ThinkTime(6.6);
    …
  end TsecondMain;

With this approach, if you run a load test with a user that executes multiple main transactions you will not experience problems with subsequent transactions if an active transaction fails and disconnects from the server.