Cannot find OCI dll.

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
cliffchan512
Posts: 20
Joined: Fri 01 Jun 2012 11:34

Cannot find OCI dll.

Post by cliffchan512 » Fri 13 Jun 2014 02:41

Hi,

Starting from version 9.2.5 to latest version 9.3.9, I encountered an issue which is error 'cannot find OCI dll' when connecting with Oracle instant clients. Prior to version 9.2.5, connection is ok with instant clients in my working environment. Please advice.

Thanks,
Cliff

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot find OCI dll.

Post by AlexP » Fri 13 Jun 2014 08:16

Hello,

Please specify where and how you "registered" instant clients: registry, environmental variables, etc.

cliffchan512
Posts: 20
Joined: Fri 01 Jun 2012 11:34

Re: Cannot find OCI dll.

Post by cliffchan512 » Mon 16 Jun 2014 02:19

Hi Alex,

I just have oracle instant client path variables in environment path only.

Thanks,
Cliff

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot find OCI dll.

Post by AlexP » Mon 16 Jun 2014 10:01

We cannot reproduce the problem. If you have specified the correct path (to the oci.dll library folder) in the system environmental variable PATH, ODAC will find and load this library. Please make sure the path really exists in this variable by executing the following command in the console:

>echo %path%

P.S. It is desirable that the path to the Oracle client is the first in this variable.

cliffchan512
Posts: 20
Joined: Fri 01 Jun 2012 11:34

Re: Cannot find OCI dll.

Post by cliffchan512 » Tue 17 Jun 2014 02:06

Hi Alex,

I traced into the source code and found that there is a procedure AddToOracleHomes() in the OraCall, the below code returns false so that no entry of instant client path is added to variable FHomes. Then the FDefault was set to nil in the procedure GetDefaultHome(). This is what I know so far, thanks!

Success := RegQueryValueEx(hOracleReg, 'OCIDLL', nil, nil, @HomePath, @Len) = ERROR_SUCCESS

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot find OCI dll.

Post by AlexP » Tue 17 Jun 2014 10:12

If a correct path to the folder containing the instant client is specified in the system environmental variable, then the method GetDefaultHome (if no record was found in the registry before) searches in the PATH environmental variable. If you register instant client in the registry, you should add a OCIDLL parameter and specify the path to the library in this parameter.

cliffchan512
Posts: 20
Joined: Fri 01 Jun 2012 11:34

Re: Cannot find OCI dll.

Post by cliffchan512 » Wed 18 Jun 2014 04:28

Hi,

I do not register instant clients in the registry and am sure that correct paths are specified in the system environmental path. I see that the paths are returned in GetEnvironmentPathVariable in GetDefaultHome, however the below condition returns false since the FHomes do not contain instant client path. Then, FDefault is set to nil.

Home := TOracleHome(FHomes);
if ((AnsiStrIComp(PChar(Home.Path + '\'), PChar(Str)) = 0) or
(AnsiStrIComp(PChar(Home.Path + '\bin\'), PChar(Str)) = 0)) and
CheckHomePath(Home.Path)

My oracle client setting works in ODAC version 9.1.4, 8.6.1 those I was trying to update and version 8.1.6 that I was using. But it fails in any versions after 9.1.4.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot find OCI dll.

Post by AlexP » Thu 19 Jun 2014 10:05

The provided code will be executed in the only case - if the FHomes.Count property is not null. Information is added in the AddToOracleHomes method only in case when there are records in the registry. If there are no records and FHomes.Count is null, then the following code is executed:

Code: Select all

  if CheckHomePath(Str) then begin
    FDefault := Add('', Str, '', '', False);
    exit;
  end;
where Str is the path retrieved from the environmental variable, that is checked for presence of oci.dll or ociw32 at this path, and if these files are detected - the path is added to the Homes list and becomes default, from which the DLL is loaded.

cliffchan512
Posts: 20
Joined: Fri 01 Jun 2012 11:34

Re: Cannot find OCI dll.

Post by cliffchan512 » Fri 20 Jun 2014 02:09

Hi,

FHome is not null and there are records in since there are also installed oracle client in my machine.

cliffchan512
Posts: 20
Joined: Fri 01 Jun 2012 11:34

Re: Cannot find OCI dll.

Post by cliffchan512 » Fri 20 Jun 2014 03:48

Hi,

It is the case that if there are both installed and instant oracle clients (don't register in the registry) installed in a machine, the instant client path would not be picked up to be used in this case. Is that correct?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot find OCI dll.

Post by AlexP » Fri 20 Jun 2014 08:51

Yes, currently, if a record about at least one Oracle client is found in the registry, then the path to the client (not registered in the registry) will be ignored in the environmental variables. We will change this behavior in the next version.

cliffchan512
Posts: 20
Joined: Fri 01 Jun 2012 11:34

Re: Cannot find OCI dll.

Post by cliffchan512 » Fri 20 Jun 2014 09:15

Hi,

When will be the next version probably? Since we are going to upgrade from 8.1.6 to a newer version but not yet decided.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Cannot find OCI dll.

Post by AlexP » Fri 20 Jun 2014 11:18

We plan to release the new version next month.

Post Reply