NHibernate Oracle - 无法加载 DLL“OraOps10w.dll”
这是我第一次使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Oracle Data Provider 需要相当多的 dll:
来自 ODAC 包:
来自 instantclient-basiclite 包:
由于您只能将 Oracle.DataAccess.dll 添加为 .NET 引用,因此您需要其他一些确保所有其他 dll 也位于 .exe 目录中的方法。
据我所知,还有一个即时客户端的安装程序,因此您不需要 .exe 目录中的这些 dll,但您必须确保所有客户端都安装了该安装程序。
The Oracle Data Provider needs quite a few dlls:
From the ODAC package:
From the instantclient-basiclite package:
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.