oracle 无法从 NHibernate.Driver.OracleDataClientDriver 创建驱动程序(复制本地设置为 true)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11728521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not create the driver from NHibernate.Driver.OracleDataClientDriver (with copy local set to true)
提问by Cosmo D
I even added to app.config this little piece of config:
我什至在 app.config 中添加了这个小小的配置:
<qualifyAssembly partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess,
Version=2.112.2.0,
Culture=neutral,
PublicKeyToken=89b483f429c47342" />
</assemblyBinding>
... with no success. What could be wrong? Also, just to be sure that my app.config is feng shui, here it is:
......没有成功。可能有什么问题?另外,为了确保我的 app.config 是风水,这里是:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
<property name="connection.driver_class">
NHibernate.Driver.OracleDataClientDriver
</property>
<property name="connection.connection_string_name">
GuitarStore2
</property>
<property name="connection.provider">
NHibernate.Connection.DriverConnectionProvider
</property>
</session-factory>
</hibernate-configuration>
<connectionStrings>
<add name="GuitarStore"
connectionString="****************"/>
<add name="GuitarStore2"
connectionString="****************"/>
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess,
Version=2.112.2.0,
Culture=neutral,
PublicKeyToken=89b483f429c47342" />
</assemblyBinding>
</runtime>
</configuration>
For the record, I am using the latest Nhibernate (3.3.1), on .NET 3.5, under Windows 7 64 bit. And, with the exact same project, I encounter no exceptions on another machine, but with Windows XP.
作为记录,我在 .NET 3.5 上使用最新的 Nhibernate (3.3.1),在 Windows 7 64 位下。而且,对于完全相同的项目,我在另一台机器上没有遇到任何例外,但在 Windows XP 上。
回答by Cosmo D
The problem wasn't NHibernate, but the fact that the IL was generating 64 bit code, whilst using the 32 bit version of ODP, so by simply changing the "Any CPU" option to "x86", I got rid of the exception.
问题不是 NHibernate,而是 IL 生成 64 位代码,同时使用 32 位版本的 ODP,因此只需将“任何 CPU”选项更改为“x86”,我就摆脱了异常。