Page 1 of 1

How to connect to other Oracle Client

Posted: Mon 05 Oct 2020 12:09
by dqrest
Hello!

I have an old project which used an Oracle Client 10.2.0.5 (x64)
Oracle Client files can be downloaded from https://www.oracle.com/ru/database/tech ... loads.html. (get instantclient-basic-win64-10.2.0.5.zip)

After changing Home property of Oracle Connection I have the error "Cannot find Oracle Home.".
How to solve this problem?

To reproduce this situation you should have:
1) MS VS 2019
2) compile C# (.NetFramework) as x64 project
3) Devart dotConnect for Oracle 9.13.1107 (trial)
3) c# code

Code: Select all

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Devart.Data.Linq;
using Devart.Data.Linq.Mapping;
using Devart.Data.Oracle;
using System.Diagnostics;

namespace Alco2
{
    class Program
    {
        static void Main(string[] args)
        {
            var Login = "x";
            var Password = "x";
            var Server = "x";
            
            var home = @"c:\Users\..."; //full path to Oracle Client 10.2.0.5 downloaded from https://www.oracle.com/ru/database/technologies/instant-client/winx64-64-downloads.html. (get instantclient-basic-win64-10.2.0.5.zip)
            try
            {
                var conn = new OracleConnection()
                {
                    UserId = Login,
                    Server = Server,
                    Password = Password,
                    Direct = false,
                    Home = home
                };
                conn.Open();

                conn.Close();
            }
            catch (Exception ex)
            {

            }
        }
    }
}


Re: How to connect to other Oracle Client

Posted: Tue 06 Oct 2020 08:09
by dqrest
I have found out, that in the Name of OracleConnection I should use a name of the item of the OracleHomeCollecttection. But I have faced to other problem, I get an item from OracleHomeCollection with empty name, but Path and ClientVersion properties have nonempty values. How to assign Name to OracleHome item?

In the OracleHomeCollection there is a method to append an OracleHome item, but I can not create an object with OracleHome item.

Re: How to connect to other Oracle Client

Posted: Thu 08 Oct 2020 11:13
by Shalex
How to Configure Oracle Client Instant:
1. Download Oracle Client Instant to a local folder.
2. Add the full path to Instant Client folder (e.g.: D:\Install\oracle_instantclient_10_2_x64) to PATH environment variable. A reboot may be required.
3. Create registry entries via *.reg file or manually:

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient_10_2_instant]
"ORACLE_HOME"="D:\Install\oracle_instantclient_10_2_x64" 
"ORACLE_HOME_NAME"="OraClient_10_2_instant" 
"ORACLE_GROUP_NAME"="Oracle - OraClient_10_2_instant" 
"NLS_LANG"="AMERICAN_AMERICA.WE8MSWIN1252"
After this, add "Home=OraClient_10_2_instant;" to your connection string and make sure that Target framework is set to x64 in the properties of your project. Now it should work.

For more information, refer to https://blog.devart.com/how-to-configur ... lient.html.