Reputation:
I've got following hibernate.cfg.xml
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory>
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.connection_string">
User ID=user;Password=password;Data Source=database
</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle9Dialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
Now I receive following error:
failed: NHibernate.MappingException : Could not compile the mapping document: Mob.Icecube.Data.NH.Mappings.Customer.hbm.xml ----> System.InvalidOperationException : Could not find the dialect in the configuration
Can anyone help me out why he cannot find the driver? Some extra info... It's running at the moment only inside a UnitTest application I added the NHibernate and System.Data.OracleClient to the references of the project Using the latest NHibernate version (2.2 beta)
Thanks in advance
Upvotes: 4
Views: 13914
Reputation: 2160
There is no NHibernate.Dialect.Oracle9Dialect dialect in the NHibernate assembly.
There is a NHibernate.Dialect.Oracle9iDialect.
Check that your NHibernate config file is being loaded correctly. Use something like:
onfiguration config = new Configuration().Configure("hibernate.cfg.xml").
This is assuming your NHibernate configuration file is called hibernate.cfg.xml and is at the root of your application.
Upvotes: 6
Reputation: 2120
I registered myself now on the site, and it seems that at the moment I'm no longer allowed to leave any comments, so I'll just post the code again in a new answer :D
To create the config and factory: Configuration config = new Configuration(); config.AddAssembly("MyLib.Data.NH"); ISessionFactory factory = config.BuildSessionFactory();
I also changed the config now to use (what should be available) Oracle10gDialect (though I tried 9i as well without success).
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="NHibernate.Test">
<property name="connection.driver_class">NHibernate.Driver.OracleClientDriver</property>
<property name="connection.connection_string">
User ID=user;Password=password;Data Source=db
</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle10gDialect</property>
<property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
</session-factory>
</hibernate-configuration>
Upvotes: 1
Reputation: 33501
Do you have the Oracle client installed locally on your pc? I believe this provides some drivers you may need to connect, but I'm not sure. If so, try copying the Oracle.DataAccess.dll file from your installation into the bin folder of your project. This has worked for me in the past.
Upvotes: 0