1

I'm working in a Windows Server 2008 R2 Enterprise x64 with C# Windows Form Application, to connect in a Oracle 11g Database with NHibernate. I used the followed NHibernate configuration:

string connectionProvider = "NHibernate.Connection.DriverConnectionProvider";
string dialect = "NHibernate.Dialect.Oracle10gDialect";
//to use OracleDataClientDriver (ODP.NET), must configure the appropriated "Plataform Target".
//In Windows Server, is not possible work with ODAC x64, because the Windows Form Application don't accept
//"Platform Target" = "Any CPU" configuration. For this, it was intalled the ODAC1120320_32bit
connectionDriver = "NHibernate.Driver.OracleDataClientDriver";
string connectionString = ...

It worked for few days, but now, the error "Could not create the driver from NHibernate.Driver.OracleDataClientDriver." appears. The C# project configuration are like the picture: enter image description here I really don't know what more tests I need to do, because ODACs for 32 and 64 bits was installed and unistalled. Please help. Thank you.

Jeferson Preti
  • 57
  • 2
  • 12
  • Do you know if `NHibernate.Driver.OracleDataClientDriver` is going against your 64bit or your 32bit ODAC? – DWright Mar 18 '15 at 22:59
  • Sorry DWright, I don't understand well your question. The installed ODAC is ODAC1120320_32bit (strange thing: this worked in my tests two weeks ago). The SO is 64 bits and the Platform Target in aplication is 32 bits (to agree with ODAC). This answer your question? Thank you – Jeferson Preti Mar 19 '15 at 00:09
  • I reference the odp.net dll, in C#, from odac client folder. – Jeferson Preti Mar 19 '15 at 00:13
  • Since you are trying to build 32 bit target, have you made sure that the 64bit ODAC is now uninstalled? I.e. have you tried it where you only have 32 it ODAC on the machine at one time? – DWright Mar 19 '15 at 02:42
  • Yes, I let only one ODAC version installed. In a moment the software was working, only ODAC1120320_32bit was installed. Now, after some tests, I installed only ODAC1120320_32bit in PC again. Thank you. – Jeferson Preti Mar 19 '15 at 09:45
  • Very strange the application run in a past moment and not work now. Assuming no changes in application and ODAC installation, what may have happened to the application not works now? – Jeferson Preti Mar 19 '15 at 09:49

1 Answers1

2

If you are using Nhibernate 4, you can use the OracleManagedDataClientDriver and the odp.net managed driver (https://www.nuget.org/packages/odp.net.managed/). This is an "any client" driver and you won't have install anything on the machine. It makes supporting Oracle so much easier. No more copying ODAC .dll's to your deployment directories.

Fran
  • 6,440
  • 1
  • 23
  • 35
  • Perfect. As I work in windows server 2008, and this SO don't allow visual studio 2013 (to use nuget packages), then I used the second answer of this post: http://stackoverflow.com/questions/4566908/how-can-i-use-nuget-with-visual-c-sharp-express. Thank you Fran. – Jeferson Preti Mar 19 '15 at 17:04