Hello,
I recieve an Exception when I try to use the NHibernate.Driver.OracleDataClientDriver.
My code to configure NHibernate is as follows:
Code:
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.OracleDialect");
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.OracleDataClientDriver");
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionString, "Server=IGDB;User=john;password=secret;");
cfg.SetProperty(NHibernate.Cfg.Environment.DefaultSchema, "schema");
cfg.AddAssembly("Carelis.Datenstrukturen");
It produces this Exception trace:
(NHibernate.Util.ReflectHelper): Could not load type Oracle.DataAccess.Client.OracleCommand, Oracle.DataAccess.
System.IO.FileNotFoundException: Die Datei oder Assembly Oracle.DataAccess oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
Dateiname: Oracle.DataAccess
bei System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
bei System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
bei System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
bei System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
bei System.Reflection.Assembly.Load(String assemblyString)
bei NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
Meaning it can't find the Assambly. I included the assambly in that project. I even did using Oracle.DataAccess; in the source file where I configure NHibernate and I added and App.config to my project with this code:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess, Version=9.2.0.700, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</assemblyBinding>
</runtime>
</configuration>
The Oracle.DataAccess Assambly is registered in the GAC and I double checked version and PublicKeyToken.
However when I use this line instead it works fine:
Code:
cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.OracleClientDriver");
But I would rather use the ODP.NET driver for it is faster, better documented and gets updated more recently and I receive other errors when using the Microsoft driver.
How can I use the Oracle Driver with NHibernate 1.2.4000 ?