Two oracle client

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Two oracle client

Post by ysyang » Tue 05 Aug 2014 08:38

Hi

I use ODAC 9.3.10 version and Delphi 2009.

my computer installed two oracle client
1) OraClient10g_home1 : 10.2.0.1.0
2) OraClient11g_home1 : 11.2.0.1.0

My code is

Code: Select all

 With OraSession1 do
 begin
   HomeName := 'OraClient10g_home1';
   Server := 'Ora130';
   UserName := 'hr';
   Password := 'password';
   Connect;
   ShowMessage('OraSession1 connected');
   Disconnect;
 end;

Code: Select all

 With OraSession2 do
 begin
   HomeName := 'OraClient11g_home1';
   Server := 'Ora131';
   UserName := 'hr';
   Password := 'password';
   Connect;
   ShowMessage('OraSession2 connected');
   Disconnect;
 end;

OraSession1 is connected but OraSession2 have caused the error.

Message is "Can't initialize OCI. Error -1."

What's the problem?

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

Re: Two oracle client

Post by AlexP » Tue 05 Aug 2014 09:18

Hello,

We can't reproduce the issue on the latest ODAC version (your code works correctly). Please make sure that both Oracle clients are 32-bit.

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Wed 06 Aug 2014 09:12

My code is

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
 With OraSession1 do
 begin
   HomeName := 'OraClient11g_home1';
   Server := '11gServer';
   UserName := 'hr';
   Password := 'admin';
   Connect;
   ShowMessage('OraClient11g_home1');
   Disconnect;
  end;
 end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 With OraSession1 do
 begin
   HomeName := 'OraClient10g_home1';
   Server := '10gServer';
   UserName := 'hr';
   Password := 'admin';
   Connect;
   ShowMessage('OraClient10g_home1');
   Disconnect;
 end;
end;
Two oracle client is all 32 bit.

1) Connection is successful, when click button1 but caused the error when click button2.
2) Connection is successful, when click button2 but caused the error when click button1.

Error message is "Can't initialize OCI. Error -1."

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Wed 06 Aug 2014 09:38

Another test code :

Code: Select all

procedure TForm1.Button3Click(Sender: TObject);
begin
  OracleHomes.Init;
  With OraSession1 do
  begin
     HomeName := 'OraClient11g_home1';
     Server := '11gServer';
     UserName := 'hr';
     Password := 'admin';
     Connect;
     ShowMessage('OraClient11g_home1');
     Disconnect;
  end;
  OracleHomes.Release;
  OracleHomes.Init;
  With OraSession1 do
  begin
     HomeName := 'OraClient10g_home1';
     Server := '10gServer';
     UserName := 'hr';
     Password := 'admin';
     Connect;
     ShowMessage('OraClient10g_home1');
     Disconnect;
  end;

end;
Caused the error when click button3.

Other error message is "ORA-12154: TNS:Could not resolve the connect identifier specified".

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Wed 06 Aug 2014 10:11

I found a new one yet.

Code: Select all

procedure TForm1.Button3Click(Sender: TObject);
begin
  OracleHomes.Init;
  With OraSession1 do
  begin
     HomeName := 'OraClient11g_home1';
     Server := '11gServer';
     UserName := 'hr';
     Password := 'admin';
     Connect;
     ShowMessage('OraClient11g_home1');
     Disconnect;
  end;
  OracleHomes.Release;
  OracleHomes.Init;
  With OraSession1 do
  begin
     HomeName := 'OraClient10g_home1';
//     Server := '10gServer';
     Server := '11gServer';
     UserName := 'hr';
     Password := 'admin';
     Connect;
     ShowMessage('OraClient10g_home1');
     Disconnect;
  end;

end;
The above code works correctly. However, This code should raise an error.
Because of "11gServer" alias is not in tnsnames.ora of Oracle 10g client

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

Re: Two oracle client

Post by AlexP » Wed 06 Aug 2014 10:48

We can't reproduce the problem on your samples. Try executing a simple console application provided below and let us know the result.

Code: Select all

program Project;

{$APPTYPE CONSOLE}

uses
  SysUtils, Ora, OraCall;

var
  OraSession: TOraSession;

begin
  OraSession := TOraSession.Create(nil);
  try
    OracleHomes.Init;
    OraSession.HomeName := 'OraClient11g_home1';
    OraSession.Server := '11gServer';
    OraSession.UserName := 'hr';
    OraSession.Password := 'admin';
    OraSession.Connect;
    WriteLn('OraClient11g_home1');
    OraSession.Disconnect;
    OracleHomes.Release;
    OracleHomes.Init;
    OraSession.HomeName := 'OraClient10g_home1';
    OraSession.Server := '10gServer';
    OraSession.UserName := 'hr';
    OraSession.Password := 'admin';
    OraSession.Connect;
    WriteLn('OraClient10g_home1');
    OraSession.Disconnect;
  finally
    OraSession.Free;
    Readln;
  

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Wed 06 Aug 2014 11:06

I receive the following error message.
"ORA-12154: TNS:Could not resolve the connect identifier specified".

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Wed 06 Aug 2014 11:09

Code: Select all

program Project;

{$APPTYPE CONSOLE}

uses
  SysUtils, Ora, OraCall;

var
  OraSession: TOraSession;

begin
  OraSession := TOraSession.Create(nil);
  try
    OracleHomes.Init;
    OraSession.HomeName := 'OraClient11g_home1';
    OraSession.Server := '11gServer';
    OraSession.UserName := 'hr';
    OraSession.Password := 'admin';
    OraSession.Connect;
    WriteLn('OraClient11g_home1');
    OraSession.Disconnect;
    OracleHomes.Release;
    OracleHomes.Init;
    OraSession.HomeName := 'OraClient10g_home1';
    OraSession.Server := '11gServer';
//    OraSession.Server := '10gServer';
    OraSession.UserName := 'hr';
    OraSession.Password := 'admin';
    OraSession.Connect;
    WriteLn('OraClient10g_home1');
    OraSession.Disconnect;
  finally
    OraSession.Free;
    Readln;
end;
end.
The above code works correctly. However, This code should raise an error.
Because of "11gServer" alias is not in tnsnames.ora of Oracle 10g client

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Wed 06 Aug 2014 11:14

My Event Log is

Code: Select all

Thread Start: Thread ID: 8300. Process Project1.exe (5756)
Process Start: C:\Users\ysyang\Documents\RAD Studio\Projects\ODAC\다중클라이언트_프로젝트만\Project1.exe. Base Address: $00400000. Process Project1.exe (5756)
Module Load: Project1.exe. Has Debug Info. Base Address: $00400000. Process Project1.exe (5756)
Module Load: ntdll.dll. No Debug Info. Base Address: $77DD0000. Process Project1.exe (5756)
Module Load: KERNEL32.dll. No Debug Info. Base Address: $765F0000. Process Project1.exe (5756)
Module Load: KERNELBASE.dll. No Debug Info. Base Address: $75D50000. Process Project1.exe (5756)
Module Load: OLEAUT32.dll. No Debug Info. Base Address: $76700000. Process Project1.exe (5756)
Module Load: ole32.dll. No Debug Info. Base Address: $77590000. Process Project1.exe (5756)
Module Load: msvcrt.dll. No Debug Info. Base Address: $75CA0000. Process Project1.exe (5756)
Module Load: GDI32.dll. No Debug Info. Base Address: $75920000. Process Project1.exe (5756)
Module Load: USER32.dll. No Debug Info. Base Address: $77440000. Process Project1.exe (5756)
Module Load: ADVAPI32.dll. No Debug Info. Base Address: $75880000. Process Project1.exe (5756)
Module Load: SECHOST.dll. No Debug Info. Base Address: $75DD0000. Process Project1.exe (5756)
Module Load: RPCRT4.dll. No Debug Info. Base Address: $75AD0000. Process Project1.exe (5756)
Module Load: SspiCli.dll. No Debug Info. Base Address: $757E0000. Process Project1.exe (5756)
Module Load: CRYPTBASE.dll. No Debug Info. Base Address: $757D0000. Process Project1.exe (5756)
Module Load: LPK.dll. No Debug Info. Base Address: $76290000. Process Project1.exe (5756)
Module Load: USP10.dll. No Debug Info. Base Address: $778B0000. Process Project1.exe (5756)
Module Load: VERSION.dll. No Debug Info. Base Address: $73720000. Process Project1.exe (5756)
Module Load: WSOCK32.dll. No Debug Info. Base Address: $721B0000. Process Project1.exe (5756)
Module Load: WS2_32.dll. No Debug Info. Base Address: $75DF0000. Process Project1.exe (5756)
Module Load: NSI.dll. No Debug Info. Base Address: $75840000. Process Project1.exe (5756)
Module Load: apphelp.dll. No Debug Info. Base Address: $70E10000. Process Project1.exe (5756)
Module Load: NULL.dll. No Debug Info. Base Address: $70D80000. Process Project1.exe (5756)
Module Load: SHELL32.dll. No Debug Info. Base Address: $76790000. Process Project1.exe (5756)
Module Load: SHLWAPI.dll. No Debug Info. Base Address: $75E30000. Process Project1.exe (5756)
Module Load: USERENV.dll. No Debug Info. Base Address: $76270000. Process Project1.exe (5756)
Module Load: profapi.dll. No Debug Info. Base Address: $75DA0000. Process Project1.exe (5756)
Module Load: WINSPOOL.DRV. No Debug Info. Base Address: $724E0000. Process Project1.exe (5756)
Module Load: MPR.dll. No Debug Info. Base Address: $72540000. Process Project1.exe (5756)
Module Load: IMM32.dll. No Debug Info. Base Address: $773E0000. Process Project1.exe (5756)
Module Load: MSCTF.dll. No Debug Info. Base Address: $75BD0000. Process Project1.exe (5756)
Module Load: NETAPI32.dll. No Debug Info. Base Address: $73310000. Process Project1.exe (5756)
Module Load: netutils.dll. No Debug Info. Base Address: $73300000. Process Project1.exe (5756)
Module Load: srvcli.dll. No Debug Info. Base Address: $732E0000. Process Project1.exe (5756)
Module Load: wkscli.dll. No Debug Info. Base Address: $732D0000. Process Project1.exe (5756)
Module Load: browcli.dll. No Debug Info. Base Address: $679A0000. Process Project1.exe (5756)
Module Load: OCI.dll. No Debug Info. Base Address: $10000000. Process Project1.exe (5756)
Module Load: MSVCR71.dll. No Debug Info. Base Address: $7C360000. Process Project1.exe (5756)
Module Load: PSAPI.DLL. No Debug Info. Base Address: $75BC0000. Process Project1.exe (5756)
Module Load: OraOCIEI10.dll. No Debug Info. Base Address: $026B0000. Process Project1.exe (5756)
Module Load: WINMM.dll. No Debug Info. Base Address: $73250000. Process Project1.exe (5756)
Module Load: IPHLPAPI.DLL. No Debug Info. Base Address: $736A0000. Process Project1.exe (5756)
Module Load: WINNSI.DLL. No Debug Info. Base Address: $73690000. Process Project1.exe (5756)
Module Load: CRYPT32.dll. No Debug Info. Base Address: $76320000. Process Project1.exe (5756)
Module Load: MSASN1.dll. No Debug Info. Base Address: $76260000. Process Project1.exe (5756)
Module Load: MSWSOCK.dll. No Debug Info. Base Address: $73740000. Process Project1.exe (5756)
Module Load: WSHTCPIP.dll. No Debug Info. Base Address: $73730000. Process Project1.exe (5756)
Thread Start: Thread ID: 7884. Process Project1.exe (5756)
Thread Start: Thread ID: 5584. Process Project1.exe (5756)
Module Load: CSCAPI.dll. No Debug Info. Base Address: $6A720000. Process Project1.exe (5756)
Module Load: UxTheme.dll. No Debug Info. Base Address: $72F60000. Process Project1.exe (5756)
Module Unload: OCI.dll. Process Project1.exe (5756)
Module Unload: OraOCIEI10.dll. Process Project1.exe (5756)
Module Unload: CRYPT32.dll. Process Project1.exe (5756)
Module Unload: MSASN1.dll. Process Project1.exe (5756)
Module Unload: IPHLPAPI.DLL. Process Project1.exe (5756)
Module Unload: WINNSI.DLL. Process Project1.exe (5756)
Module Unload: WINMM.dll. Process Project1.exe (5756)
Module Unload: PSAPI.DLL. Process Project1.exe (5756)
Module Unload: MSVCR71.dll. Process Project1.exe (5756)
Module Unload: WSHTCPIP.dll. Process Project1.exe (5756)
Module Load: OCI.dll. No Debug Info. Base Address: $10000000. Process Project1.exe (5756)
Module Load: MSVCR80.dll. No Debug Info. Base Address: $66180000. Process Project1.exe (5756)
Module Load: PSAPI.DLL. No Debug Info. Base Address: $75BC0000. Process Project1.exe (5756)
Module Load: OraOCIEI11.dll. No Debug Info. Base Address: $086A0000. Process Project1.exe (5756)
Module Load: WINMM.dll. No Debug Info. Base Address: $73250000. Process Project1.exe (5756)
Module Load: IPHLPAPI.DLL. No Debug Info. Base Address: $736A0000. Process Project1.exe (5756)
Module Load: WINNSI.DLL. No Debug Info. Base Address: $73690000. Process Project1.exe (5756)
Module Load: CRYPT32.dll. No Debug Info. Base Address: $76320000. Process Project1.exe (5756)
Module Load: MSASN1.dll. No Debug Info. Base Address: $76260000. Process Project1.exe (5756)
Module Load: Secur32.dll. No Debug Info. Base Address: $72180000. Process Project1.exe (5756)
Module Load: dbghelp.dll. No Debug Info. Base Address: $64A90000. Process Project1.exe (5756)
Module Load: WSHIP6.dll. No Debug Info. Base Address: $73710000. Process Project1.exe (5756)
Module Load: nlaapi.dll. No Debug Info. Base Address: $71E20000. Process Project1.exe (5756)
Module Load: NAPINSP.dll. No Debug Info. Base Address: $71B20000. Process Project1.exe (5756)
Module Load: PNRPNSP.dll. No Debug Info. Base Address: $71B00000. Process Project1.exe (5756)
Module Load: DNSAPI.dll. No Debug Info. Base Address: $736C0000. Process Project1.exe (5756)
Module Load: WINRNR.dll. No Debug Info. Base Address: $71AF0000. Process Project1.exe (5756)
Module Load: wshbth.dll. No Debug Info. Base Address: $71AE0000. Process Project1.exe (5756)
Module Load: WS2_32.dll. No Debug Info. Base Address: $005D0000. Process Project1.exe (5756)
Module Unload: WS2_32.dll. Process Project1.exe (5756)
Module Load: WSHTCPIP.dll. No Debug Info. Base Address: $73730000. Process Project1.exe (5756)
Module Load: rasadhlp.dll. No Debug Info. Base Address: $73680000. Process Project1.exe (5756)
Module Load: fwpuclnt.dll. No Debug Info. Base Address: $73640000. Process Project1.exe (5756)
Thread Start: Thread ID: 8272. Process Project1.exe (5756)
Last OraOCIEI11.dll Loaded. What's problem?

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

Re: Two oracle client

Post by AlexP » Fri 08 Aug 2014 07:59

There are some problems related to uploading and downloading libraries while using Oracle Instant Client. Such behaviour occurs due to the client itself. This is why there is an error in your example. To avoid such errors, you need to install the full Oracle client.

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Fri 08 Aug 2014 23:17

Hello AlexP!

Yes. I understand what you say.
My oracle client is Oracle Instant Client.

Thank you

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

Re: Two oracle client

Post by AlexP » Mon 11 Aug 2014 06:29

You are welcome. If you have any more questions or suggestions regarding our components, please contact us again.

ysyang
Posts: 44
Joined: Tue 14 Jun 2005 09:10

Re: Two oracle client

Post by ysyang » Tue 12 Aug 2014 09:59

Ok! Thank you very much

Post Reply