Oracle procedure with authid and direct mode

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
-gt-
Posts: 1
Joined: Tue 20 Nov 2018 08:43

Oracle procedure with authid and direct mode

Post by -gt- » Tue 20 Nov 2018 09:38

In Oracle

Code: Select all

SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
PL/SQL Release 12.2.0.1.0 - Production
CORE    12.2.0.1.0    Production
TNS for Linux: Version 12.2.0.1.0 - Production
NLSRTL Version 12.2.0.1.0 - Production

SQL> create or replace procedure test_authid
  2  authid current_user
  3  is
  4  begin
  5      null;
  6  end test_authid;
  7  /

Procedure created

SQL>
In Delphi
Delphi 10.2 Update 3
ODAC 10.2.6
Direct Mode

Code: Select all

uses
  Ora;

procedure TForm1.b1Click(Sender: TObject);
var
  OraSession: TOraSession;
  OraStoredProc: TOraStoredProc;
begin
  OraSession := TOraSession.Create(Self);
  OraStoredProc := TOraStoredProc.Create(Self);
  try
    OraSession.Server := 'myOracleServer:1521:sn=myService;
    OraSession.Username := 'username';
    OraSession.Password := 'password';
    OraSession.Options.Direct := True; // <----------
    OraSession.Connect;

    OraStoredProc.Session := OraSession;
    OraStoredProc.StoredProcName := 'test_authid';
    OraStoredProc.Prepare; // <- Exception class EDBError with message 'Unknown error 1'.

  finally
    FreeAndNil(OraStoredProc);

    if OraSession.Connected then
      OraSession.Close;
    FreeAndNil(OraSession);
  end;
end;
OCI Mode

Code: Select all

uses
  Ora;

procedure TForm1.b1Click(Sender: TObject);
var
  OraSession: TOraSession;
  OraStoredProc: TOraStoredProc;
begin
  OraSession := TOraSession.Create(Self);
  OraStoredProc := TOraStoredProc.Create(Self);
  try
    OraSession.Server := 'myOracleServer';
    OraSession.Username := 'username';
    OraSession.Password := 'password';
    OraSession.Options.Direct := False; // <----------
    OraSession.Connect;

    OraStoredProc.Session := OraSession;
    OraStoredProc.StoredProcName := 'test_authid';
    OraStoredProc.Prepare; // <- OK!

  finally
    FreeAndNil(OraStoredProc);

    if OraSession.Connected then
      OraSession.Close;
    FreeAndNil(OraSession);
  end;
end;

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Oracle procedure with authid and direct mode

Post by MaximG » Tue 20 Nov 2018 17:15

Thank you for the information. We will investigate the described issue and let you know the results shortly.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Oracle procedure with authid and direct mode

Post by MaximG » Mon 26 Nov 2018 16:05

We reproduced the issue and fixed this error. The fix will be included in the next version of ODAC. As a workaround, we can now send you a night build of our product. For this, provide your license number and the RAD Studio versions that you are using via the e-support form (https://www.devart.com/company/contactform.html)

Post Reply