-->
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.  [ 4 posts ] 
Author Message
 Post subject: NHibernate - Could not create driver from System...OracleCli
PostPosted: Tue Feb 07, 2006 4:23 pm 
Newbie

Joined: Tue Feb 07, 2006 3:57 pm
Posts: 6
Hi,
I am trying to setup NHibernate with Oracle and am getting a "Could not create driver from System.Data.OracleClient" error when I try to "BuildSessionFactory()".

I am using:
1. C# on Visual Studio 2003
2. .NET 1.1
3. Oracle 9.2
4. using System.Data.OracleClient

The configuration looks like this:
----------------------------------------------------------------------------
Code:
   
<nhibernate>
      <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
      <add key="hibernate.dialect" value="NHibernate.Dialect.Oracle9Dialect" />
      <add key="hibernate.connection.driver_class" value="System.Data.OracleClient" />
      <add key="hibernate.connection.connection_string" value="user id=username;pwd=password;data source=DEV10" />
      <add key="hibernate.show_sql" value="true" />
</nhibernate>

------------------------------------------------------------------------------

And I am trying to create the Session like this:
------------------------------------------------------------------------------
Code:
vendorDataConfig = new Configuration().AddAssembly(System.Reflection.Assembly.GetCallingAssembly());
ISessionFactory factory = null;
factory = vendorDataConfig.BuildSessionFactory();
session = factory.OpenSession();

-------------------------------------------------------------------------------

Stacktrace:
-------------------------------------------------------------------------------
Code:
ERROR LoadVendorDataApp.Data.VendorDataDAO -    at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary settings)
   at NHibernate.Connection.ConnectionProvider.Configure(IDictionary settings)
   at NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary settings)
   at NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary properties)
   at NHibernate.Cfg.Configuration.BuildSettings()
   at NHibernate.Cfg.Configuration.BuildSessionFactory()
   at LoadVendorDataApp.Data.VendorDataDAO..ctor() in c:\my projects\...

---------------------------------------------------------------------------------


Has anyone encountered this problem before?

Any help would be much appreciated.

Thanks,
-MR.


Top
 Profile  
 
 Post subject: Re: NHibernate - Could not create driver from System...Oracl
PostPosted: Tue Feb 07, 2006 4:56 pm 
Regular
Regular

Joined: Fri Jan 27, 2006 2:32 pm
Posts: 102
Location: California, USA
Mel wrote:
Hi,
I am trying to setup NHibernate with Oracle and am getting a "Could not create driver from System.Data.OracleClient" error when I try to "BuildSessionFactory()".


Your configuration looks fine to me. I am using Oracle as well. It is the same as my config, however, I am using VS 2005.

Put a try block around your BuildSessionFactory() call and look at the exception thrown. For me, this is usually more helpful - since bad hbm.xml mappings usually result in exceptions here.

--Brian


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 5:32 pm 
Newbie

Joined: Tue Feb 07, 2006 3:57 pm
Posts: 6
I found this in my log:
Code:
ERROR <> -    at NHibernate.Util.ReflectHelper.ClassForName(String name)
   at NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary settings)
2006-02-07 16:28:23,603 [5056] ERROR LoadVendorDataApp.Data.VendorDataDAO - Could not load type 'System.Data.OracleClient, NHibernate, Version=1.0.2.0, Culture=neutral, PublicKeyToken=154fdcb44c4484fc', check that type and assembly names are correct


Seems like NHibernate is having difficulty finding the Oracle Driver.
Also, would you be so kind as to post your App.config or the file where you specify the NHibernate configuration?

Best Regards,
-MR


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 6:08 pm 
Newbie

Joined: Tue Feb 07, 2006 3:57 pm
Posts: 6
Seems like the correct way to specify the hibernate config is as below:

Code:
   <nhibernate>
      <add key="hibernate.connection.driver_class" value="NHibernate.Driver.OracleClientDriver" />
      <add key="hibernate.dialect"                 value="NHibernate.Dialect.OracleDialect" />
      <add key="hibernate.connection.provider"     value="NHibernate.Connection.DriverConnectionProvider" />
      <add key="hibernate.connection.connection_string" value="user id=user;pwd=password;data source=DATASOURCE" />
   </nhibernate>


Found it at: http://www.castleproject.org/index.php/ ... _Reference

At least it doesn't fail on trying to load the OracleClient driver


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.