Ora8Logon Function

Action

Create a simple logon session.

Include file

Ora8.bdh

Syntax

Ora8Logon( in  hEnv      : number,
           out hSvcCtx   : number,
           in  sUser     : string,
           in  sPassword : string optional,
           in  sConnect  : string optional,
           in  nMode     : number optional): boolean;

Return value

  • true if successful

  • false otherwise; In this case, you can use the Ora8OciError function to retrieve the Oracle OCI error code.

Parameter Description
hEnv The environment handle.
hSvcCtx Variable receiving the initialized service context handle.
sUser

User Identification. This parameter contains either only the user name or the user name, the password, and the host machine identifier. In the latter case, it is necessary to insert a / character between the user name and the password, and a @ character between the password and the connect string. Valid examples are shown below:

  • name

  • name/password

  • name@service_name

  • name/password@service_name

sPassword Password (optional). If the password is specified through the sUser parameter, this parameter should be omitted or set to NULL.
sConnect SQL*Net connect descriptor (optional). If the connect string is passed through the sUser parameter, this parameter should be omitted.
nMode

Specifies the various modes of operation (optional).

Valid values are:

  • OCI_DFAULT (default)

Example

var
  ghEnv0        : number;
  ghError0      : number;
  ghSvcCtx0     : number;
  bOK           : boolean;

dcltrans
  transaction TMain
  begin
    Ora8Init(ghEnv0, OCI_DEFAULT);
    Ora8HandleAlloc(ghEnv0, ghError0, OCI_HTYPE_ERROR);
    bOK := Ora8Logon(ghEnv0, ghSvcCtx0, "user", "password", "orclnet2");
     
    if bOk then
      write("Connection to database established."); writeln;
    else
      write("Error connecting to database."); writeln;
    end;

    ...
    
    Ora8Logoff(ghSvcCtx0);
    Ora8HandleFree(ghError0, OCI_HTYPE_ERROR);
    Ora8HandleFree(ghEnv0, OCI_HTYPE_ENV);
  end TMain; 

Output

Connection to database established.

See Also

Oracle's Programmer's Guide to Oracle Call Interface for Wrapped Oracle function: OCILogon, OCILogon2