OraLogon Function

Action

Establishes a connection to an Oracle database. Using this function, you can establish multiple connections to either a single database or to several Oracle instances at the same time.

Include file

Ora.bdh

Syntax

OraLogon( out hConnection : number,
          in  sUser       : string,
          in  sPassword   : string optional,
          in  sConnect    : string optional): boolean;

Return value

  • true if successful

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

Parameter Description
hConnection Variable receiving the handle to the database connection.
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 V2 connect descriptor (optional). If the connect string is passed through the sUser parameter, this parameter should be omitted

Example

var
  hConnection: number;
dcltrans
  transaction TMain
  var
    bOk: boolean;
  begin
    bOk := OraLogon(hConnection, "user", "password", "orclnet2");
  
    if bOk then
      write("Connection to database established"); writeln;
    else      write("Error connecting to database"); writeln;
    end;
    ...
    OraLogoff(hConnection);
  end TMain;

Output

Connection to database established

Sample scripts

OraArrayFetch.bdf, OraSample.bdf, OraLoadPers.bdf