Kbase 21213: How To Write an AppServer Connect Procedure -- An example
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/16/2008 |
|
Status: Verified
GOAL:
How to write an AppServer connect procedure -- an example
FIX:
Specify this procedure as the connect procedure in either of two places:
a) 'Advanced' tab of the AppServer Properties in Progress Explorer.
b) Through the 'srvrConnectProc' parameter in the ubroker.properties file.
For details on usage of an AppServer connect procedure, please see Progress Solution 21186.
/* asConnect.p */
DEFINE INPUT PARAMETER pcUserID AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcPassWd AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER pcMisc AS CHARACTER NO-UNDO.
DEFINE VARIABLE iDB AS INTEGER NO-UNDO.
DEFINE VARIABLE lOk AS LOGICAL NO-UNDO.
/* If there is no value specified for pcUserID, that means the client
application could be a SmartObject application which passes these
values as the 3rd parameter. This assumes that the SmartObject
application is passing a comma separated list of userid and password*/
IF pcUserID EQ "" OR
pcUserID EQ ? THEN
ASSIGN pcUserID = ENTRY(1,pcMisc)
pcPassWd = ENTRY(2,pcMisc).
/* Loop through the list of connected databases and authenticate the
userid and password. This will be more complicated if the various
databases require different userids and passwords.*/
DO iDB = 1 TO NUM-DBS:
lOk = SETUSERID(pcUserID,pcPassWd,LDBNAME(iDB)) NO-ERROR.
END.
IF ERROR-STATUS:ERROR OR
NOT lOk THEN
RETURN ERROR.
/* end asConnect.p */