Ora8SessionBegin Function

Action

Creates a user session and begins a user session for a given server.

Include file

Ora8.bdh

Syntax

Ora8SessionBegin( in hSvcCtx  : number,
                  in hSession : number,
                  in nCredt   : number optional,
                  in nMode    : number optional ) : boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hSvcCtx A handle to a service context. There must be a valid server handle set in the service context handle.
hSession A handle to a user session context, which is initialized by this call.
nCredt

Specifies the type of credentials to use for establishing the user session (optional).

Valid values are:

  • OCI_CRED_RDBMS

  • OCI_CRED_EXT

nMode

Specifies the various modes of operation (optional).

Valid modes are:

  • OCI_DEFAULT (default)

  • OCI_MIGRATE

  • OCI_SYSDBA

  • OCI_SYSOPER

  • OCI_PRELIM_AUTH

Example

var
  ghEnv0        : number;
  ghError0      : number;
  ghServer0     : number;
  ghSvcCtx0     : number;
  ghSession0    : number;

dcltrans
  transaction TMain
  begin
    Ora8Init(ghEnv0);
    Ora8HandleAlloc(ghEnv0, ghError0, OCI_HTYPE_ERROR);
    Ora8HandleAlloc(ghEnv0, ghServer0, OCI_HTYPE_SERVER);
    Ora8HandleAlloc(ghEnv0, ghSvcCtx0, OCI_HTYPE_SVCCTX);
    Ora8ServerAttach(ghServer0, "ORCLNET2");
    Ora8AttrSetHandle(ghSvcCtx0, OCI_HTYPE_SVCCTX, ghServer0, OCI_ATTR_SERVER);
    Ora8HandleAlloc(ghEnv0, ghSession0, OCI_HTYPE_SESSION);
    Ora8AttrSetString(ghSession0, OCI_HTYPE_SESSION, "SCOTT", OCI_ATTR_USERNAME);
    Ora8AttrSetString(ghSession0, OCI_HTYPE_SESSION, "TIGER", OCI_ATTR_PASSWORD);
    Ora8SessionBegin(ghSvcCtx0, ghSession0, OCI_CRED_RDBMS);
    Ora8AttrSetHandle(ghSvcCtx0, OCI_HTYPE_SVCCTX, ghSession0, OCI_ATTR_SESSION);

    ...

    Ora8SessionEnd(ghSvcCtx0, ghSession0);
    Ora8HandleFree(ghSession0, OCI_HTYPE_SESSION);
    Ora8ServerDetach(ghServer0);
    Ora8HandleFree(ghSvcCtx0, OCI_HTYPE_SVCCTX);
    Ora8HandleFree(ghServer0, OCI_HTYPE_SERVER);
    Ora8HandleFree(ghError0, OCI_HTYPE_ERROR);
    Ora8HandleFree(ghEnv0, OCI_HTYPE_ENV);
  end TMain;

See Also

Oracle's Programmer's Guide to Oracle Call Interface for Wrapped Oracle function: OCISessionBegin