将C#连接到Oracle数据库所需的最小客户端占用空间是多少?

时间:2021-05-20 09:50:40

I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008) by downloading and installing the client administration tools and Visual Studio 2008 on my laptop.

通过在笔记本电脑上下载并安装客户端管理工具和Visual Studio 2008,我已成功连接到C#(Visual Studio 2008)的Oracle数据库(10g)。

The installation footprint for Oracle Client tools was over 200Mb, and quite long winded.

Oracle客户端工具的安装占用空间超过200Mb,而且耗时很长。

Does anyone know what the minimum workable footprint is? I am hoping that it's a single DLL and a register command, but I have the feeling I need to install an oracle home, and set various environment variables.

有谁知道最小可行足迹是什么?我希望它是一个DLL和一个寄存器命令,但我觉得我需要安装一个oracle home,并设置各种环境变量。

I am using Oracle.DataAccess in my code.

我在我的代码中使用Oracle.DataAccess。

8 个解决方案

#1


69  

You need an Oracle Client to connect to an Oracle database. The easiest way is to install the Oracle Data Access Components.

您需要Oracle客户端才能连接到Oracle数据库。最简单的方法是安装Oracle数据访问组件。

To minimize the footprint, I suggest the following :

为了减少占地面积,我建议如下:

  • Use the Microsoft provider for Oracle (System.Data.OracleClient), which ships with the framework.
  • 使用随框架提供的Microsoft提供程序for Oracle(System.Data.OracleClient)。

  • Download the Oracle Instant Client Package - Basic Lite : this is a zip file with (almost) the bare minimum. I recommend version 10.2.0.4, which is much smaller than version 11.1.0.6.0.
  • 下载Oracle Instant Client Package - Basic Lite:这是一个(几乎)最低限度的zip文件。我推荐版本10.2.0.4,它比版本11.1.0.6.0小得多。

  • Unzip the following files in a specific folder :
    • v10 :
      • oci.dll
      • orannzsbb10.dll
      • oraociicus10.dll
    • v10:oci.dll orannzsbb10.dll oraociicus10.dll

    • v11 :
      • oci.dll
      • orannzsbb11.dll
      • oraociei11.dll
    • v11:oci.dll orannzsbb11.dll oraociei11.dll

  • 解压缩特定文件夹中的以下文件:v10:oci.dll orannzsbb10.dll oraociicus10.dll v11:oci.dll orannzsbb11.dll oraociei11.dll

  • On a x86 platform, add the CRT DLL for Visual Studio 2003 (msvcr71.dll) to this folder, as Oracle guys forgot to read this...
  • 在x86平台上,将Visual Studio 2003的CRT DLL(msvcr71.dll)添加到此文件夹,因为Oracle家伙忘记阅读此内容...

  • Add this folder to the PATH environment variable.
  • 将此文件夹添加到PATH环境变量。

  • Use the Easy Connect Naming method in your application to get rid of the infamous TNSNAMES.ORA configuration file. It looks like this : sales-server:1521/sales.us.acme.com.
  • 在应用程序中使用Easy Connect命名方法来摆脱臭名昭着的TNSNAMES.ORA配置文件。它看起来像这样:sales-server:1521 / sales.us.acme.com。

This amounts to about 19Mb (v10).

这相当于约19Mb(v10)。

If you do not care about sharing this folder between several applications, an alternative would be to ship the above mentioned DLLs along with your application binaries, and skip the PATH setting step.

如果您不关心在多个应用程序之间共享此文件夹,则可以选择将上述DLL与应用程序二进制文件一起发送,并跳过PATH设置步骤。

If you absolutely need to use the Oracle provider (Oracle.DataAccess), you will need :

如果您绝对需要使用Oracle提供程序(Oracle.DataAccess),则需要:

  • ODP .NET 11.1.0.6.20 (the first version which allegedly works with Instant Client).
  • ODP .NET 11.1.0.6.20(据称可与Instant Client配合使用的第一个版本)。

  • Instant Client 11.1.0.6.0, obviously.
  • 显然,Instant Client 11.1.0.6.0。

Note that I haven't tested this latest configuration...

请注意,我还没有测试过这个最新配置......

#2


16  

As of 2014, the OPD.NET, Managed Driver is the smallest footprint.

截至2014年,OPD.NET,托管驱动程序占地面积最小。

Here is a code usage comparison to the non-managed versions that previous (outdated) answers suggested: http://docs.oracle.com/cd/E51173_01/win.122/e17732/intro005.htm#ODPNT148

以下是与以前(过时)答案建议的非托管版本的代码使用情况比较:http://docs.oracle.com/cd/E51173_01/win.122/e17732/intro005.htm#ODPNT148

You will need to download these dlls and reference Oracle.ManagedDataAccess.dll in your project: Download the ODP.NET, Managed Driver Xcopy version only

您需要在项目中下载这些dll并引用Oracle.ManagedDataAccess.dll:仅下载ODP.NET,托管驱动程序Xcopy版本

Here is a typical foot print you will need to package with your release:

这是您需要在发布时打包的典型足迹:

  1. Oracle.ManagedDataAccess.dll
  2. Oracle.ManagedDataAccessDTC.dll

all together, a whopping 6.4 MB for .Net 4.0.

总而言之,.Net 4.0高达6.4 MB。

#3


15  

I use the method suggested by Pandicus above, on Windows XP, using ODAC 11.2.0.2.1. The steps are as follows:

我在Windows XP上使用Pandicus建议的方法,使用ODAC 11.2.0.2.1。步骤如下:

  1. Download the "ODAC 11.2 Release 3 (11.2.0.2.1) with Xcopy Deployment" package from oracle.com (53 MB), and extract the ZIP.
  2. 从oracle.com(53 MB)下载“带有Xcopy部署的ODAC 11.2版本3(11.2.0.2.1)”软件包,并解压缩ZIP。

  3. Collect the following DLLs: oci.dll (1 MB), oraociei11.dll (130 MB!), OraOps11w.dll (0.4 MB), Oracle.DataAccess.dll (1 MB). The remaining stuff can be deleted, and nothing have to be installed.
  4. 收集以下DLL:oci.dll(1 MB),oraociei11.dll(130 MB!),OraOps11w.dll(0.4 MB),Oracle.DataAccess.dll(1 MB)。剩余的东西可以删除,不需要安装任何东西。

  5. Add a reference to Oracle.DataAccess.dll, add using Oracle.DataAccess.Client; to your code and now you can use types like OracleConnection, OracleCommand and OracleDataReader to access an Oracle database. See the class documentation for details. There is no need to use the tnsnames.ora configuration file, only the connection string must be set properly.
  6. 添加对Oracle.DataAccess.dll的引用,使用Oracle.DataAccess.Client添加;到您的代码,现在您可以使用OracleConnection,OracleCommand和OracleDataReader等类型来访问Oracle数据库。有关详细信息,请参阅类文档。无需使用tnsnames.ora配置文件,只需正确设置连接字符串。

  7. The above 4 DLLs have to be deployed along with your executable.
  8. 以上4个DLL必须与您的可执行文件一起部署。

#4


14  

This way allows you to connect with ODP.net using 5 redistributable files from oracle:

这种方式允许您使用oracle中的5个可再发行文件与ODP.net连接:

Chris's blog entry: Using the new ODP.Net to access Oracle from C# with simple deployment

Chris的博客文章:使用新的ODP.Net通过简单的部署从C#访问Oracle

Edit: In case the blog every goes down, here is a brief summary...

编辑:如果博客每次都下降,这里是一个简短的总结......

  • oci.dll
  • Oracle.DataAccess.dll
  • oraociicus11.dll
  • OraOps11w.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • ociw32.dll

make sure you get ALL those DLL's from the same ODP.Net / ODAC distribution to avoid version number conflicts, and put them all in the same folder as your EXE

确保从相同的ODP.Net / ODAC发行版中获取所有这些DLL以避免版本号冲突,并将它们全部放在与EXE相同的文件夹中

#5


8  

DevArt http://www.devart.com/, formerly CoreLab (crlab.com) supplies a pure-C# Oracle client. That's a single dll, and it works fine.

DevArt http://www.devart.com/,以前CoreLab(crlab.com)提供纯C#Oracle客户端。这是一个单独的DLL,它工作正常。

#6


5  

Here is an update for Oracle 11.2.0.4.0. I had success with the following procedure on Windows 7 using System.Data.OracleClient.

以下是Oracle 11.2.0.4.0的更新。我在Windows 7上使用System.Data.OracleClient成功完成了以下过程。

1. Download Instant Client Package - Basic Lite: Windows 32-Bit or 64-Bit.

1.下载Instant Client Package - Basic Lite:Windows 32位或64位。

2. Copy the following files to a location in your system path:

2.将以下文件复制到系统路径中的某个位置:

32-Bit

 1,036,288  2013-10-11  oci.dll
   348,160  2013-10-11  ociw32.dll
 1,290,240  2013-09-21  orannzsbb11.dll
   562,688  2013-10-11  oraocci11.dll
36,286,464  2013-10-11  oraociicus11.dll

64-Bit

   691,712  2013-10-09  oci.dll
   482,304  2013-10-09  ociw32.dll
 1,603,072  2013-09-10  orannzsbb11.dll
 1,235,456  2013-10-09  oraocci11.dll
45,935,104  2013-10-09  oraociicus11.dll

3. Construct a connection string that omits the need for tnsnames.ora.

3.构造一个省略tnsnames.ora需求的连接字符串。

(See examples in the test program below.)

(参见下面测试程序中的示例。)

4. Run this minimal C# program to test your installation:

4.运行这个最小的C#程序来测试你的安装:

using System;
using System.Data;
using System.Data.OracleClient;

class TestOracleInstantClient
{
    static public void Main(string[] args)
    {
        const string host = "yourhost.yourdomain.com";
        const string serviceName = "yourservice.yourdomain.com";
        const string userId = "foo";
        const string password = "bar";

        var conn = new OracleConnection();

        // Construct a connection string using Method 1 or 2.
        conn.ConnectionString =
            GetConnectionStringMethod1(host, serviceName, userId, password);

        try
        {
            conn.Open();
            Console.WriteLine("Connection succeeded.");
            // Do something with the connection.
            conn.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine("Connection failed: " + e.Message);
        }
    }

    static private string GetConnectionStringMethod1(
        string host,
        string serviceName,
        string userId,
        string password
        )
    {
        string format =
            "SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)" +
            "(HOST={0})(PORT=1521))" +
            "(CONNECT_DATA=(SERVER=DEDICATED)" +
            "(SERVICE_NAME={1})));" +
            "uid={2};" +
            "pwd={3};"; // assumes port is 1521 (the default)

        return String.Format(format, host, serviceName, userId, password);
    }

    static private string GetConnectionStringMethod2(
        string host,
        string serviceName,
        string userId,
        string password
        )
    {
        string format =
            "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)" +
            "(HOST={0})(PORT=1521))" +
            "(CONNECT_DATA=(SERVER=DEDICATED)" +
            "(SERVICE_NAME={1})));" +
            "User Id={2};" +
            "Password={3};"; // assumes port is 1521 (the default)

        return String.Format(format, host, serviceName, userId, password);
    }
}

Final tip: If you encounter the error "System.Data.OracleClient requires Oracle client software version 8.1.7", see this question.

最后提示:如果遇到错误“System.Data.OracleClient需要Oracle客户端软件版本8.1.7”,请参阅此问题。

#7


3  

ODAC xcopy will get you away with about 45MB. http://www.oracle.com/technology/software/tech/windows/odpnet/index.html

ODAC xcopy将为您带来大约45MB的空间。 http://www.oracle.com/technology/software/tech/windows/odpnet/index.html

#8


2  

I found this post on the Oracle forum very usefull as well:

我在Oracle论坛上发现这篇文章非常有用:

How to setup Oracle Instant Client with Visual Studio

Remark: the ADO.NET team is deprecating System.Data.OracleClient so for future projects you should use ODP.NET

备注:ADO.NET团队正在弃用System.Data.OracleClient,因此对于将来的项目,您应该使用ODP.NET

Reproduction:

Setup the following environment variables:

设置以下环境变量:

  1. make sure no other oracle directory is in your PATH
  2. 确保PATH中没有其他oracle目录

  3. set your PATH to point to your instant client
  4. 将PATH设置为指向您的即时客户端

  5. set your TNS_ADMIN to point to where you tnsnames.ora file is located
  6. 将TNS_ADMIN设置为指向tnsnames.ora文件所在的位置

  7. set your NLS_LANG
  8. 设置你的NLS_LANG

  9. set your ORACLE_HOME to your instant client
  10. 将您的ORACLE_HOME设置为您的即时客户端

For me, I set NLS_LANG to

对我来说,我将NLS_LANG设置为

http://download-east.oracle.com/docs/html/A95493_01/gblsupp.htm#634282

I verified this was using the correct client software by using the sqlplus add-on to the instant client.

我通过使用即时客户端的sqlplus插件验证了这是使用正确的客户端软件。

For me, I set: SET NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252

对我来说,我设置:SET NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252

Note: before you make any changes, back up your Oracle registry key (if exist) and backup the string for any environment variables.

注意:在进行任何更改之前,请备份Oracle注册表项(如果存在)并备份任何环境变量的字符串。

Read the Oracle Instant Client FAQ here

在此处阅读Oracle Instant Client常见问题解答

#1


69  

You need an Oracle Client to connect to an Oracle database. The easiest way is to install the Oracle Data Access Components.

您需要Oracle客户端才能连接到Oracle数据库。最简单的方法是安装Oracle数据访问组件。

To minimize the footprint, I suggest the following :

为了减少占地面积,我建议如下:

  • Use the Microsoft provider for Oracle (System.Data.OracleClient), which ships with the framework.
  • 使用随框架提供的Microsoft提供程序for Oracle(System.Data.OracleClient)。

  • Download the Oracle Instant Client Package - Basic Lite : this is a zip file with (almost) the bare minimum. I recommend version 10.2.0.4, which is much smaller than version 11.1.0.6.0.
  • 下载Oracle Instant Client Package - Basic Lite:这是一个(几乎)最低限度的zip文件。我推荐版本10.2.0.4,它比版本11.1.0.6.0小得多。

  • Unzip the following files in a specific folder :
    • v10 :
      • oci.dll
      • orannzsbb10.dll
      • oraociicus10.dll
    • v10:oci.dll orannzsbb10.dll oraociicus10.dll

    • v11 :
      • oci.dll
      • orannzsbb11.dll
      • oraociei11.dll
    • v11:oci.dll orannzsbb11.dll oraociei11.dll

  • 解压缩特定文件夹中的以下文件:v10:oci.dll orannzsbb10.dll oraociicus10.dll v11:oci.dll orannzsbb11.dll oraociei11.dll

  • On a x86 platform, add the CRT DLL for Visual Studio 2003 (msvcr71.dll) to this folder, as Oracle guys forgot to read this...
  • 在x86平台上,将Visual Studio 2003的CRT DLL(msvcr71.dll)添加到此文件夹,因为Oracle家伙忘记阅读此内容...

  • Add this folder to the PATH environment variable.
  • 将此文件夹添加到PATH环境变量。

  • Use the Easy Connect Naming method in your application to get rid of the infamous TNSNAMES.ORA configuration file. It looks like this : sales-server:1521/sales.us.acme.com.
  • 在应用程序中使用Easy Connect命名方法来摆脱臭名昭着的TNSNAMES.ORA配置文件。它看起来像这样:sales-server:1521 / sales.us.acme.com。

This amounts to about 19Mb (v10).

这相当于约19Mb(v10)。

If you do not care about sharing this folder between several applications, an alternative would be to ship the above mentioned DLLs along with your application binaries, and skip the PATH setting step.

如果您不关心在多个应用程序之间共享此文件夹,则可以选择将上述DLL与应用程序二进制文件一起发送,并跳过PATH设置步骤。

If you absolutely need to use the Oracle provider (Oracle.DataAccess), you will need :

如果您绝对需要使用Oracle提供程序(Oracle.DataAccess),则需要:

  • ODP .NET 11.1.0.6.20 (the first version which allegedly works with Instant Client).
  • ODP .NET 11.1.0.6.20(据称可与Instant Client配合使用的第一个版本)。

  • Instant Client 11.1.0.6.0, obviously.
  • 显然,Instant Client 11.1.0.6.0。

Note that I haven't tested this latest configuration...

请注意,我还没有测试过这个最新配置......

#2


16  

As of 2014, the OPD.NET, Managed Driver is the smallest footprint.

截至2014年,OPD.NET,托管驱动程序占地面积最小。

Here is a code usage comparison to the non-managed versions that previous (outdated) answers suggested: http://docs.oracle.com/cd/E51173_01/win.122/e17732/intro005.htm#ODPNT148

以下是与以前(过时)答案建议的非托管版本的代码使用情况比较:http://docs.oracle.com/cd/E51173_01/win.122/e17732/intro005.htm#ODPNT148

You will need to download these dlls and reference Oracle.ManagedDataAccess.dll in your project: Download the ODP.NET, Managed Driver Xcopy version only

您需要在项目中下载这些dll并引用Oracle.ManagedDataAccess.dll:仅下载ODP.NET,托管驱动程序Xcopy版本

Here is a typical foot print you will need to package with your release:

这是您需要在发布时打包的典型足迹:

  1. Oracle.ManagedDataAccess.dll
  2. Oracle.ManagedDataAccessDTC.dll

all together, a whopping 6.4 MB for .Net 4.0.

总而言之,.Net 4.0高达6.4 MB。

#3


15  

I use the method suggested by Pandicus above, on Windows XP, using ODAC 11.2.0.2.1. The steps are as follows:

我在Windows XP上使用Pandicus建议的方法,使用ODAC 11.2.0.2.1。步骤如下:

  1. Download the "ODAC 11.2 Release 3 (11.2.0.2.1) with Xcopy Deployment" package from oracle.com (53 MB), and extract the ZIP.
  2. 从oracle.com(53 MB)下载“带有Xcopy部署的ODAC 11.2版本3(11.2.0.2.1)”软件包,并解压缩ZIP。

  3. Collect the following DLLs: oci.dll (1 MB), oraociei11.dll (130 MB!), OraOps11w.dll (0.4 MB), Oracle.DataAccess.dll (1 MB). The remaining stuff can be deleted, and nothing have to be installed.
  4. 收集以下DLL:oci.dll(1 MB),oraociei11.dll(130 MB!),OraOps11w.dll(0.4 MB),Oracle.DataAccess.dll(1 MB)。剩余的东西可以删除,不需要安装任何东西。

  5. Add a reference to Oracle.DataAccess.dll, add using Oracle.DataAccess.Client; to your code and now you can use types like OracleConnection, OracleCommand and OracleDataReader to access an Oracle database. See the class documentation for details. There is no need to use the tnsnames.ora configuration file, only the connection string must be set properly.
  6. 添加对Oracle.DataAccess.dll的引用,使用Oracle.DataAccess.Client添加;到您的代码,现在您可以使用OracleConnection,OracleCommand和OracleDataReader等类型来访问Oracle数据库。有关详细信息,请参阅类文档。无需使用tnsnames.ora配置文件,只需正确设置连接字符串。

  7. The above 4 DLLs have to be deployed along with your executable.
  8. 以上4个DLL必须与您的可执行文件一起部署。

#4


14  

This way allows you to connect with ODP.net using 5 redistributable files from oracle:

这种方式允许您使用oracle中的5个可再发行文件与ODP.net连接:

Chris's blog entry: Using the new ODP.Net to access Oracle from C# with simple deployment

Chris的博客文章:使用新的ODP.Net通过简单的部署从C#访问Oracle

Edit: In case the blog every goes down, here is a brief summary...

编辑:如果博客每次都下降,这里是一个简短的总结......

  • oci.dll
  • Oracle.DataAccess.dll
  • oraociicus11.dll
  • OraOps11w.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • ociw32.dll

make sure you get ALL those DLL's from the same ODP.Net / ODAC distribution to avoid version number conflicts, and put them all in the same folder as your EXE

确保从相同的ODP.Net / ODAC发行版中获取所有这些DLL以避免版本号冲突,并将它们全部放在与EXE相同的文件夹中

#5


8  

DevArt http://www.devart.com/, formerly CoreLab (crlab.com) supplies a pure-C# Oracle client. That's a single dll, and it works fine.

DevArt http://www.devart.com/,以前CoreLab(crlab.com)提供纯C#Oracle客户端。这是一个单独的DLL,它工作正常。

#6


5  

Here is an update for Oracle 11.2.0.4.0. I had success with the following procedure on Windows 7 using System.Data.OracleClient.

以下是Oracle 11.2.0.4.0的更新。我在Windows 7上使用System.Data.OracleClient成功完成了以下过程。

1. Download Instant Client Package - Basic Lite: Windows 32-Bit or 64-Bit.

1.下载Instant Client Package - Basic Lite:Windows 32位或64位。

2. Copy the following files to a location in your system path:

2.将以下文件复制到系统路径中的某个位置:

32-Bit

 1,036,288  2013-10-11  oci.dll
   348,160  2013-10-11  ociw32.dll
 1,290,240  2013-09-21  orannzsbb11.dll
   562,688  2013-10-11  oraocci11.dll
36,286,464  2013-10-11  oraociicus11.dll

64-Bit

   691,712  2013-10-09  oci.dll
   482,304  2013-10-09  ociw32.dll
 1,603,072  2013-09-10  orannzsbb11.dll
 1,235,456  2013-10-09  oraocci11.dll
45,935,104  2013-10-09  oraociicus11.dll

3. Construct a connection string that omits the need for tnsnames.ora.

3.构造一个省略tnsnames.ora需求的连接字符串。

(See examples in the test program below.)

(参见下面测试程序中的示例。)

4. Run this minimal C# program to test your installation:

4.运行这个最小的C#程序来测试你的安装:

using System;
using System.Data;
using System.Data.OracleClient;

class TestOracleInstantClient
{
    static public void Main(string[] args)
    {
        const string host = "yourhost.yourdomain.com";
        const string serviceName = "yourservice.yourdomain.com";
        const string userId = "foo";
        const string password = "bar";

        var conn = new OracleConnection();

        // Construct a connection string using Method 1 or 2.
        conn.ConnectionString =
            GetConnectionStringMethod1(host, serviceName, userId, password);

        try
        {
            conn.Open();
            Console.WriteLine("Connection succeeded.");
            // Do something with the connection.
            conn.Close();
        }
        catch (Exception e)
        {
            Console.WriteLine("Connection failed: " + e.Message);
        }
    }

    static private string GetConnectionStringMethod1(
        string host,
        string serviceName,
        string userId,
        string password
        )
    {
        string format =
            "SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)" +
            "(HOST={0})(PORT=1521))" +
            "(CONNECT_DATA=(SERVER=DEDICATED)" +
            "(SERVICE_NAME={1})));" +
            "uid={2};" +
            "pwd={3};"; // assumes port is 1521 (the default)

        return String.Format(format, host, serviceName, userId, password);
    }

    static private string GetConnectionStringMethod2(
        string host,
        string serviceName,
        string userId,
        string password
        )
    {
        string format =
            "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)" +
            "(HOST={0})(PORT=1521))" +
            "(CONNECT_DATA=(SERVER=DEDICATED)" +
            "(SERVICE_NAME={1})));" +
            "User Id={2};" +
            "Password={3};"; // assumes port is 1521 (the default)

        return String.Format(format, host, serviceName, userId, password);
    }
}

Final tip: If you encounter the error "System.Data.OracleClient requires Oracle client software version 8.1.7", see this question.

最后提示:如果遇到错误“System.Data.OracleClient需要Oracle客户端软件版本8.1.7”,请参阅此问题。

#7


3  

ODAC xcopy will get you away with about 45MB. http://www.oracle.com/technology/software/tech/windows/odpnet/index.html

ODAC xcopy将为您带来大约45MB的空间。 http://www.oracle.com/technology/software/tech/windows/odpnet/index.html

#8


2  

I found this post on the Oracle forum very usefull as well:

我在Oracle论坛上发现这篇文章非常有用:

How to setup Oracle Instant Client with Visual Studio

Remark: the ADO.NET team is deprecating System.Data.OracleClient so for future projects you should use ODP.NET

备注:ADO.NET团队正在弃用System.Data.OracleClient,因此对于将来的项目,您应该使用ODP.NET

Reproduction:

Setup the following environment variables:

设置以下环境变量:

  1. make sure no other oracle directory is in your PATH
  2. 确保PATH中没有其他oracle目录

  3. set your PATH to point to your instant client
  4. 将PATH设置为指向您的即时客户端

  5. set your TNS_ADMIN to point to where you tnsnames.ora file is located
  6. 将TNS_ADMIN设置为指向tnsnames.ora文件所在的位置

  7. set your NLS_LANG
  8. 设置你的NLS_LANG

  9. set your ORACLE_HOME to your instant client
  10. 将您的ORACLE_HOME设置为您的即时客户端

For me, I set NLS_LANG to

对我来说,我将NLS_LANG设置为

http://download-east.oracle.com/docs/html/A95493_01/gblsupp.htm#634282

I verified this was using the correct client software by using the sqlplus add-on to the instant client.

我通过使用即时客户端的sqlplus插件验证了这是使用正确的客户端软件。

For me, I set: SET NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252

对我来说,我设置:SET NLS_LANG = AMERICAN_AMERICA.WE8MSWIN1252

Note: before you make any changes, back up your Oracle registry key (if exist) and backup the string for any environment variables.

注意:在进行任何更改之前,请备份Oracle注册表项(如果存在)并备份任何环境变量的字符串。

Read the Oracle Instant Client FAQ here

在此处阅读Oracle Instant Client常见问题解答