NHibernate Oracle Connection?

时间:2008-10-27 19:12:49

标签: nhibernate

我是第一次为NHibernate设置Oracle连接。我已将Oracle.DataAccess.dll文件复制到我的bin文件夹中。无论我尝试什么,我都会遇到同样的错误:

Could not load type >NHibernate.Driver.OracleDataClientDriver. Possible cause: no assembly name specified. 

我使用以下配置:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory name="DefaultSessionFactory">
        <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
        <property name="dialect">NHibernate.Dialect.Oracle9Dialect</property>
        <property name="connection.driver_class">>NHibernate.Driver.OracleDataClientDriver</property>
        <property name="connection.connection_string">Data Source=DB;User ID=USERPassword=****;</property>       
        <property name="show_sql">true</property>
        <mapping assembly="NHibernateExample.DataAccess"/>
    </session-factory>
</hibernate-configuration>

我以前只为SQL Server设置了NHibernate。我在这里错过了什么吗?

4 个答案:

答案 0 :(得分:9)

您是否复制并粘贴了代码?因为有额外的&gt;在那里,在connection.driver_class行

答案 1 :(得分:2)

半冒号分隔符在用户ID值和密码之间丢失。

答案 2 :(得分:2)

将NHibernate连接到Oracle的优秀分步教程: http://nhbwithoracle.blogspot.com/

答案 3 :(得分:0)

一旦遇到类似的问题,我就通过在属性名称中添加hibernate来修复它:

<property name="hibernate.connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="hibernate.dialect">NHibernate.Dialect.Oracle9Dialect</property>
<property name="hibernate.connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
<property name="hibernate.connection.connection_string">Data Source=DB;User ID=USERPassword=****;</property>  

希望有所帮助