Page 1 of 1

OCI-21522, AllocObject in DLL

Posted: Mon 09 Nov 2015 03:45
by DmitryV
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?

Re: OCI-21522, AllocObject in DLL

Posted: Mon 09 Nov 2015 13:27
by MaximG
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.

Re: OCI-21522, AllocObject in DLL

Posted: Mon 09 Nov 2015 14:12
by DmitryV
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?

Re: OCI-21522, AllocObject in DLL

Posted: Tue 10 Nov 2015 14:33
by MaximG
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.

Re: OCI-21522, AllocObject in DLL

Posted: Fri 13 Nov 2015 08:32
by DmitryV
Thanks for the reply, Maxim. It would be really useful.

Re: OCI-21522, AllocObject in DLL

Posted: Fri 13 Nov 2015 12:44
by MaximG
Please contact us concerning ODAC usage

Re: OCI-21522, AllocObject in DLL

Posted: Wed 23 Dec 2015 10:27
by DmitryV
ODAC 9.6.21, it works! :)

Many thanks!