NHibernate 和 Oracle Lite [英] NHibernate and Oracle Lite

查看:46
本文介绍了NHibernate 和 Oracle Lite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人能够成功地将 NHibernate 与 Oracle Lite 一起使用,如果是,你能告诉我我们需要在 hibernate.cfg.xml 中提到什么,我的意思是哪种方言以及我们如何连接到它.谢谢.

Has anyone able to successfully used NHibernate with Oracle Lite,If yes can you tell me what do we need to mention in hibernate.cfg.xml , I mean which dialect and how do we connect to it. Thanks.

推荐答案

这是我前段时间做的一个测试项目的 app.config :

Here's the app.config for a test project I made some time ago :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
  </configSections>
  <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="dialect">NHibernate.Dialect.OracleLiteDialect</property>
      <property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>
      <property name="connection.connection_string">dsn=TheDSN;uid=TheUserId;pwd=ThePassword</property>
      <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
      <property name="show_sql">true</property>
    </session-factory>
  </hibernate-configuration>
</configuration>

注意:连接到本地Oracle Lite数据库:

Note : to connect to the local Oracle Lite database :

  • DSN 通常构建为 _<数据库名称>
  • 用户ID是SYSTEM
  • 密码是 Oracle Lite 用户的实际密码

比如你的OL用户名是SCOTT,密码是TIGER,数据库名是FOO,那么Oracle Lite的连接字符串是:dsn=SCOTT_FOO;uid=SYSTEM;pwd=TIGER

For instance, if your OL user name is SCOTT, your password is TIGER, and the database name is FOO, the Oracle Lite connection string is : dsn=SCOTT_FOO;uid=SYSTEM;pwd=TIGER

希望能帮到你

这篇关于NHibernate 和 Oracle Lite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆