Can TOraSession use the connection of a Pro*C program?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Orange
Posts: 6
Joined: Wed 19 May 2010 13:37

Can TOraSession use the connection of a Pro*C program?

Post by Orange » Tue 03 Aug 2010 16:31

We have a Pro*C DLL which connects to Oracle. We would like to use this connection with our Delphi 5 ODAC TOraSession, so we have only one connection instead of two. In the DLL I export a global:

sqllda(&OracleLda);

In Delphi I get OracleLda pointer with an extern function. I was under the impression that we could assign this LDA to the TOraSession.LDA, but the field is read-only.

Is there another way ?

Tx.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Thu 05 Aug 2010 16:06

Hello

The connection LDA handle is used in old Oracle versions (until Oracle 7). Since Oracle 8 the OCISvcCtx connection handle is used the OCISvcCtx connection handle. You can get OCISvcCtx from your Pro*C DLL and assign it to TOraSession.

Orange
Posts: 6
Joined: Wed 19 May 2010 13:37

Post by Orange » Thu 05 Aug 2010 20:33

I have tried with the LDA property, but the property in TOraSession is read-only and cannot be assigned. Idem with OraSvsCtx. So it does not seems possible.

You have code sample ?

Orange
Posts: 6
Joined: Wed 19 May 2010 13:37

Post by Orange » Thu 05 Aug 2010 20:42

Just tested OCISvcCtx, its not read only, so I will try this. Tx.

Orange
Posts: 6
Joined: Wed 19 May 2010 13:37

Post by Orange » Fri 06 Aug 2010 22:19

:D Works indeed! Here is the Pro*C code to export whas is needed to share the connexion:

Code: Select all


#include 
#include 

OCISvcCtx* STDCALL GetOciSvcCtx() // (simplified. do after connect
{
	OCISvcCtx* svchp; // OCI Service context handle

	SQLSvcCtxGet(0,0,-1,&svchp);

	return svchp;
}

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Mon 09 Aug 2010 11:49

It is good to see that this problem has been solved. If any other questions come up, please contact me.

Post Reply