Print Thread
Share TOracleSession session handle to FireDAC TFDConnection
#66796 05/15/25 01:23 PM
Joined: Aug 2000
Posts: 3
Portugal
C
Member
OP Offline
Member
C
Joined: Aug 2000
Posts: 3
Portugal
We would like to share Oracle connection handle between Direct Oracle Access (DOA) component TOracleSession and FireDAC TFDConnection component. We tried several ways but it seems that FireDAC uses it own custom complex "handle" format (see FireDAC.Phys.Oracle.pas):

function TFDPhysOracleConnection.InternalGetCliHandle: Pointer;
begin
if FEnv <> nil then begin
FCliHandles[0] := FEnv.Handle;
FCliHandles[1] := FService.Handle;
FCliHandles[2] := FServer.Handle;
FCliHandles[3] := FSession.Handle;
FCliHandles[4] := TFDPhysOracleTransaction(TransactionObj).FTransaction.Handle;
FCliHandles[5] := FEnv.Error.Handle;
FCliHandles[6] := pOCIHandle(PChar(FEnv.CharsetName));
FCliHandles[7] := pOCIHandle(FEnv.ExplicitCharsetID);
FCliHandles[8] := pOCIHandle(FEnv.ByteSemantic);
Result := @FCliHandles;
end
else
Result := nil;
end;

How can we get all these parts from DOA TOracleSession component? Or maybe we can take some handles from FireDAC TFDConnection and set them in DOA TOracleSession?

Re: Share TOracleSession session handle to FireDAC TFDConnection
confidentia #66798 05/16/25 09:01 AM
Joined: Aug 1999
Posts: 22,663
Member
Offline
Member
Joined: Aug 1999
Posts: 22,663
These handle types are not available for a TOracleSession. You can however set the ExternalSVC proprerty to the service context handle of the FireDAC connection. Note that you need to set ExternalSVC to nil before the FireDAC connection logs off.

Quote
TOracleSession.ExternalSVC

Declaration
property ExternalSVC: Pointer;

Description
Runtime property to attach the TOracleSession to a Net8 service context handle of another host program, or to access the service context handle of the session. When you set this property, it is equivalent to calling the LogOn method. Setting ExternalSVC to nil is equivalent to calling LogOff.


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.047s Queries: 14 (0.009s) Memory: 2.5000 MB (Peak: 3.0398 MB) Data Comp: Off Server Time: 2025-06-14 13:34:19 UTC
Valid HTML 5 and Valid CSS