These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 
Author Message
 Post subject: Problems with NHibernate 1.2.0.4000 and ODP.NET
PostPosted: Fri Aug 17, 2007 5:47 am 
Newbie

Joined: Thu Aug 16, 2007 11:07 am
Posts: 9
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 ?


Top
 Profile  
 
 Post subject: Problems with NHibernate 1.2.0.4000 and ODP.NET
PostPosted: Sun Aug 19, 2007 4:03 am 
Newbie

Joined: Fri Aug 17, 2007 8:53 am
Posts: 2
I had the same problem. I solved this by copying Oracle.DataAccess.dll into the bin directory (bin\Release resp. bin\Debug).

I also thought that it should suffice to register the driver in the GAC but that did not work, i don't know exactly why?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 19, 2007 2:45 pm 
Beginner
Beginner

Joined: Wed May 02, 2007 12:24 am
Posts: 41
I think your qualified assembly had the wrong version...this works for me.

I'm using oracle 10g:

<qualifyAssembly
partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342" />


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 4:39 am 
Newbie

Joined: Thu Aug 16, 2007 11:07 am
Posts: 9
Hello,

thank you both for your answers!

h1 wrote:
I think your qualified assembly had the wrong version...this works for me.

I'm using oracle 10g:

<qualifyAssembly
partialName="Oracle.DataAccess"
fullName="Oracle.DataAccess, Version=10.2.0.100, Culture=neutral, PublicKeyToken=89b483f429c47342" />


I used the exact version that is registered in the assambly cache. I'm trying to install the newest (non beta) ODP.NET version.

Raluethke wrote:
I had the same problem. I solved this by copying Oracle.DataAccess.dll into the bin directory (bin\Release resp. bin\Debug).

I also thought that it should suffice to register the driver in the GAC but that did not work, i don't know exactly why?


I have a multi project solution. Only one of this solutions includes the Oracle.DataAccess.dll - should it be sufficient to copy the dll to the bin\Release and bin\Debug directory of this project (with output type dll) or did you copy it to every project in your solution?


Top
 Profile  
 
 Post subject: Problems with NHibernate 1.2.0.4000 and ODP.NET
PostPosted: Mon Aug 20, 2007 11:06 am 
Newbie

Joined: Fri Aug 17, 2007 8:53 am
Posts: 2
I also have a multi project solution and I copied the dll into the directories where the .exe file of the final solution resides.

I also include the Oracle.DataAccess.dll in the distribution when I deploy my application.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 11:12 am 
Newbie

Joined: Thu Aug 16, 2007 11:07 am
Posts: 9
Hi!

Thank you! I solved my problem by setting the reference to the actually dll (c:\orant\odp.net\2.x\Oracle.DataAccess.dll for my system) instead of using the reference of the assembly cache. In this way Visual Studio does the copying on it's own.

I think it is critical as well to have matching ODP.NET and Oracle Client Versions as well.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 20, 2007 12:35 pm 
Beginner
Beginner

Joined: Wed May 02, 2007 12:24 am
Posts: 41
Would you please provide a link to the version of the odp.net you downloaded. I'm having several issues, specially with classes that have save-before-update set to true. I wonder if I have the wrong version of the odp.

Thanks!


Top
 Profile  
 
 Post subject: Multiple versions of ODP.NET?
PostPosted: Mon Aug 20, 2007 11:03 pm 
Newbie

Joined: Sat Jun 09, 2007 7:41 am
Posts: 4
Location: Melbourne
I've previously had problems when multiple version of ODP.NET were installed. If this is the case, two things to take note of are:

1) Assembly version redirection policy files are added to the GAC, pointing references to previous versions of Oracle.DataAccess to the latest. This may not be what you desire.

2) The order of Oracle install directories on the PATH variables determines which set of unmanaged Dlls for ODP.NET is loaded. Make sure the installation you want is first in the path.

You can find more info in the ODP.NET FAQ.

Andy.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 3:35 am 
Newbie

Joined: Thu Aug 16, 2007 11:07 am
Posts: 9
Hello h1,

I installed the newest non beta Version which is available with Visual Studio Developer Tools as

Oracle Developer Tools for Visual Studio .NET with Oracle10g Release 2 ODAC 10.2.0.2.21

or without Developer Tools as Oracle10g Release 2 ODAC 10.2.0.2.21

from this site: http://www.oracle.com/technology/softwa ... index.html

Along with that I did a clean install of the newest Oracle Client Software (not the Instant Client) for Windows XP. I deleted all other Client Versions and references.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 21, 2007 12:56 pm 
Beginner
Beginner

Joined: Wed May 02, 2007 12:24 am
Posts: 41
Thanks for the info, I'll follow your method hopefully it will solve my problem with select-before-update mappings (http://forum.hibernate.org/viewtopic.php?t=978589)

Regards.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 23, 2007 10:47 am 
Beginner
Beginner

Joined: Wed May 02, 2007 12:24 am
Posts: 41
Hi SFI,

I tried your method but I'm still having the same problem.

When you say you installed the latest oracle client...do you mean oracle xe?

Sorry I don't know anything about oracle.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 23, 2007 11:05 am 
Newbie

Joined: Thu Aug 16, 2007 11:07 am
Posts: 9
I mean the Oracle Database 10g Client Release 2 (10.2.0.1.0) which can be found here for Windows 32bit: http://www.oracle.com/technology/softwa ... nsoft.html

Here is an overview for other platforms (click on Oracle Database 10g for your platform and you will be directed to a page similar to the one I posted above): http://www.oracle.com/technology/softwa ... index.html

You need to define the tnsnames.ora in $youroracledir$\network\admin according to your DB connection. If you have no clue about oracle then you propably want to ask people around you or read some tutorials because these are not NHibernate specific problems.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 24, 2007 12:45 am 
Beginner
Beginner

Joined: Wed May 02, 2007 12:24 am
Posts: 41
thanks sfi your link was of great help!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.