GET-DB-CLIENT ( db-exp )An optional character expression that evaluates to a case-insensitive logical or alias name of an OpenEdge RDBMS. This expression can be unspecified or evaluate to the Unknown value (?) only if there is a single OpenEdge database connection, in which case the client-principal object handle is returned for that connection.In the following procedure fragment, GET-DB-CLIENT returns the sealed client-principal that the CONNECT statement creates from authenticating a new connection to the sports2000 database based on the user ID (cUserID) and password (cPasswd) that are passed as input parameters:
DEFINE INPUT PARAMETER cUserID AS CHARACTER NO-UNDO.DEFINE INPUT PARAMETER cPasswd AS CHARACTER NO-UNDO.DEFINE VARIABLE hCP AS HANDLE NO-UNDO.CONNECT C:\OpenEdge\WRK\db\Sports2000VALUE( "-U " + cUserID +" -P " + "oech1::" + AUDIT-POLICY:ENCRYPT-AUDIT-MAC-KEY(cPasswd))-H dbserver -S 1900 NO-ERROR.ASSIGN hCP = GET-DB-CLIENT("sports2000").SECURITY-POLICY:LOAD-DOMAINS("sports2000").SECURITY-POLICY:SET-CLIENT(hCP).DELETE OBJECT hCP.
ASSIGN hCP = ?.The fragment then loads the ABL session domain registry from the sports2000 database and uses the returned client-principal object (hCP) to set the session identity (and the identities of any other available database connections) to the existing sports2000 connection identity. The fragment ends by deleting the client-principal, which is no longer needed for the session.Typically, you also check the LOGIN-STATE attribute and STATE-DETAIL attribute on the client-principal object handle, along with other error handling mechanisms, to identity if both the database connection and its authentication are successful.Note also that this fragment encrypts the password value (cPasswd) and concatenates it with a prefix in a form that OpenEdge expects for encrypted passwords. For more information, see the ENCRYPT-AUDIT-MAC-KEY( ) method reference entry.
You can use the client-principal object returned by this function to set the identity for this and other database connections or ABL sessions using single sign-on (SSO) operations unless the object represents an OpenEdge default connection identity. A default connection identity is set by establishing a database connection without specifying the User ID (-U) and Password (-P) connection parameters, either on the AVM startup command line or as options of the CONNECT statement.For more information on how OpenEdge sets a default connection identity, see the reference entry for the User ID (-U) client connection parameter in OpenEdge Deployment: Startup Command and Parameter Reference.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |