OCI-21522, AllocObject in DLL

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
DmitryV
Posts: 12
Joined: Mon 05 May 2014 04:33

OCI-21522, AllocObject in DLL

Post by DmitryV » Mon 09 Nov 2015 03:45

I'm passing Oracle session connect to DLL from EXE.

In DLL:

Code: Select all

DLLOraSession := TOraSession.Create(Self);
// "ACtx" is EXEOraSession.OCISvcCtx.hOCISvcCtx
DLLOraSession.AssignSvcCtx(ACtx);
DLLOraStoredProc.Session := DLLOraSession;
And use it, such as:

Code: Select all

DLLOraStoredProc.ParamByName('INPUT_LIST_ID').DataType := ftArray;
DLLOraStoredProc.ParamByName('INPUT_LIST_ID').AsArray.OCISvcCtx := DLLOraStoredProc.Session.OCISvcCtx;
DLLOraStoredProc.ParamByName('INPUT_LIST_ID').AsArray.AllocObject('ORA_SHEMA.LIST_ID');
On the third line, when called AllocObject, there is an error OCI-21522.
ODAC 9.6.20, XE5

How to solve this problem properly, to use Oracle objects in the session transmitted to DLL from EXE?

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

Re: OCI-21522, AllocObject in DLL

Post by MaximG » Mon 09 Nov 2015 13:27

Use the AssignConnect method when initializing an OraSession inside DLL:

DLLOraSession := TOraSession.Create(Self);
DLLOraSession.AssignConnect(EXEOraSession);

The AssignConnect method is designed for retrieving common access to an Oracle session by several TOraSession components:
https://www.devart.com/odac/docs/?devar ... ssion).htm

When using the AssignConnect method, Array parameters will be used correctly. A sample of working with DLL with ODAC is available in the [ODAC install folder]\ Demos\Miscellaneous\Dll\ folder.

DmitryV
Posts: 12
Joined: Mon 05 May 2014 04:33

Re: OCI-21522, AllocObject in DLL

Post by DmitryV » Mon 09 Nov 2015 14:12

Hello, Maxim.

Of course, I know about AssignConnect, but object transferring (instances of TOraSession) between executable modules (can be different versions of ODAC) is "no way" for me.
AssignSvcCtx method was perfect so far And I want to continue this nice path :-)

Maybe there is some workable solution?

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

Re: OCI-21522, AllocObject in DLL

Post by MaximG » Tue 10 Nov 2015 14:33

We will consider the possibility to use the AssignSvcCtx method for access to Oracle session from different DLLs when working with complex data types. For the time being, use the AssignConnect method for these purposes.

DmitryV
Posts: 12
Joined: Mon 05 May 2014 04:33

Re: OCI-21522, AllocObject in DLL

Post by DmitryV » Fri 13 Nov 2015 08:32

Thanks for the reply, Maxim. It would be really useful.

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

Re: OCI-21522, AllocObject in DLL

Post by MaximG » Fri 13 Nov 2015 12:44

Please contact us concerning ODAC usage

DmitryV
Posts: 12
Joined: Mon 05 May 2014 04:33

Re: OCI-21522, AllocObject in DLL

Post by DmitryV » Wed 23 Dec 2015 10:27

ODAC 9.6.21, it works! :)

Many thanks!

Post Reply