NHibernate Oracle - 无法加载 DLL“OraOps10w.dll”

发布于 2024-12-10 21:15:43 字数 2046 浏览 0 评论 0原文

这是我第一次使用 nHibernate(也从未使用过 hibernate),我正在尝试使用 oracle db 来做到这一点。我的项目是一个MVC3 Web应用程序,VS20010。所以,这是我的配置文件:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory>
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
    <property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
    <property name="connection.connection_string">Data Source=srcname;User ID=myuser;Password=****;Unicode=True</property>
    <property name="show_sql">true</property>
  </session-factory>
</hibernate-configuration> 

以下是我构建会话的方式(从 nhibernate forge 复制)

private static ISessionFactory SessionFactory
        {
            get
            {
                if (_sessionFactory == null)
                {
                    var configuration = new Configuration();
                    configuration.Configure();
                    configuration.AddAssembly(typeof(Categoria).Assembly);
                    _sessionFactory = configuration.BuildSessionFactory();
                }
                return _sessionFactory;
            }
        }

我当前的错误消息是:

无法加载 DLL“OraOps10w.dll”:找不到指定的模块。 (HRESULT 异常:0x8007007E),位于 _sessionFactory = configuration.BuildSessionFactory();

在此之前我遇到了一些问题,这导致我:

  • 添加 Oracle.DataAccess.dll 的引用
  • 在 web.config 上添加 DbproviderFactories 标记。如下:(由于某种原因无法将所有代码粘贴到此处)

add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory,
      Oracle.DataAccess,
      Version=2.111.6.20,
      Culture=neutral,
      PublicKeyToken=89b483f429c47342" 

It's my first time using nHibernate (also never used hibernate), and i'm trying to do it with an oracle db. My project is a MVC3 Web Application, VS20010. So, here is my config file:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory>
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
    <property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
    <property name="connection.connection_string">Data Source=srcname;User ID=myuser;Password=****;Unicode=True</property>
    <property name="show_sql">true</property>
  </session-factory>
</hibernate-configuration> 

The following is how i build the session (copied from nhibernate forge)

private static ISessionFactory SessionFactory
        {
            get
            {
                if (_sessionFactory == null)
                {
                    var configuration = new Configuration();
                    configuration.Configure();
                    configuration.AddAssembly(typeof(Categoria).Assembly);
                    _sessionFactory = configuration.BuildSessionFactory();
                }
                return _sessionFactory;
            }
        }

My current error message is:

Unable to load DLL 'OraOps10w.dll': Couldn't find specified module. (Exception from HRESULT: 0x8007007E), at _sessionFactory = configuration.BuildSessionFactory();

I've faced a few problems before this one, wich led me to:

  • Add a reference of Oracle.DataAccess.dll
  • Add a DbproviderFactories tag on web.config. As follows: (couldn't paste all code here for some reason)
add name="Oracle Data Provider for .NET"
invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET"
type="Oracle.DataAccess.Client.OracleClientFactory,
      Oracle.DataAccess,
      Version=2.111.6.20,
      Culture=neutral,
      PublicKeyToken=89b483f429c47342" 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦言归人 2024-12-17 21:15:43

Oracle Data Provider 需要相当多的 dll:

来自 ODAC 包:

  • Oracle.DataAccess.dll(这是整个列表中唯一的 .NET 程序集)
  • OraOps11w.dll

来自 instantclient-basiclite 包:

  • oci.dll
  • ociw32.dll
  • orannzsbb11 .dll
  • oraocci11.dll
  • oraociicus11.dll

由于您只能将 Oracle.DataAccess.dll 添加为 .NET 引用,因此您需要其他一些确保所有其他 dll 也位于 .exe 目录中的方法。

据我所知,还有一个即时客户端的安装程序,因此您不需要 .exe 目录中的这些 dll,但您必须确保所有客户端都安装了该安装程序。

The Oracle Data Provider needs quite a few dlls:

From the ODAC package:

  • Oracle.DataAccess.dll (this is the only .NET assembly in the whole list)
  • OraOps11w.dll

From the instantclient-basiclite package:

  • oci.dll
  • ociw32.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • oraociicus11.dll

Since you can only add the Oracle.DataAccess.dll as a .NET reference you need some other way to make sure that all other dlls are in the .exe directory too.

As far as I know there is also an installer for the instant client so that you don't need those dlls in you .exe directory, but then you have to make sure that all clients have that installed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文