I have .NET 3.5 application wrote in C# using NHibernate.
Before I has OracleClientDriver in connection.driver_class property, that say that I use System.Data.Oracle and all works fine, but for some reasons now I need using ODP, so I changed this property to: NHibernate.Driver.OracleDataClientDriver.
When I run my code I get following error during Session Factory creation:
Unable to cast object of type 'Oracle.DataAccess.Client.OracleConnection' to type 'System.Data.Common.DbConnection'
After short searching in Inernet I found solution: to add:
<property name="hbm2ddl.keywords">none</property>
So now NHibernate successfully build Session Factory but fall in session.Flush() with following error:
System.ArgumentException: Value does not fall within the expected range
at Oracle.DataAccess.Client.OracleParameter.set_DbType(DbType value)
at NHibernate.Driver.DriverBase.InitializeParameter(IDbDataParameter dbParam, String name, SqlTypes sqlType)
Any ideas?
Thank you for ahead.
But this give me following
I get it working!!!
I win!
So what I did before:
I get Oracle.DataAccess.dll from Oracle Client bin directory and referenced it from my project assembly. When I run NHibernate Configure() function I get first error. When I removed the reference I get error that says that I need to use qalifyAssembly element in app.config for reference GAC Oracle.DataAccess.dll.
So what I did to resolve it:
I went to GAC and compare versions of Oracle.DataAccess dlls there with one I referenced before. It was: version of that that I recently referenced was: 10.x.x.x and version of dll in GAC (actualy there were number of DataAccess dlls) was 2.x.x.x. Here:
http://tiredblogger.wordpress.com/2008/ … s-library/
I found error similar to my, and I added this code
to app.config like described in above and refernenced this dll. I don’t know why I need to do both, but only so it works.