<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-16  評(píng)論-9  文章-0  trackbacks-0
         Hibernate加載其配置文件hibernate.properties和hibernate.cfg.xml,常用xml文件比較直觀,方便管理, Hibernate 是一個(gè)流行的開(kāi)源對(duì)象關(guān)系映射工具,方便連接不同數(shù)據(jù)庫(kù),更換數(shù)據(jù)庫(kù),只要修改Hibernate配置文件,大度減少項(xiàng)目的維護(hù)。
         完整的配置如下:
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
    >

    <hibernate-configuration>

        
    <session-factory>

            
    <!-- Database connection settings -->
            
    <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
            
    <property name="connection.url">jdbc:hsqldb:hsql://localhost/test</property>
            
    <property name="connection.username">sa</property>
            
    <property name="connection.password"></property>

            
    <!-- JDBC connection pool (use the built-in) -->
            
    <property name="connection.pool_size">1</property>

            
    <!-- SQL dialect -->
            
    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>

            
    <!-- Enable Hibernate's automatic session context management -->
            
    <property name="current_session_context_class">thread</property>

            
    <!-- Disable the second-level cache  -->
            
    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

            
    <!-- Echo all executed SQL to stdout -->
            
    <property name="show_sql">true</property>

            
    <!-- Drop and re-create the database schema on startup -->
            
    <property name="hbm2ddl.auto">create</property>

            
    <mapping resource="../*.hbm.xml"/>

        
    </session-factory>

    </hibernate-configuration>
         常用數(shù)據(jù)庫(kù)連接
         MySql 3/4/5:
       <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
      

       <
    property name="connection.driver_class">com.mysql.jdbc.Driver</property>
      
    <property name="connection.url">jdbc:mysql://localhost:3306/test</property>    
      
    <property name="connection.username">root</property>
      
    <property name="connection.password"></property>
        Microsoft SQLServer (via jTDS):
       <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
      

       <
    property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
      
    <property name="connection.url">jdbc:jtds:sqlserver://localhost:1433/test;useCursors=true</property>    
      
    <property name="connection.username">sa</property>
      
    <property name="connection.password"></property>  
        IBM DB2:
       <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
      

       <
    property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
      
    <property name="connection.url">jdbc:db2://localhost:50000/test</property>    
      
    <property name="connection.username">db2inst1</property>
      
    <property name="connection.password"></property> 
        Oracle:
       <property name="dialect">org.hibernate.dialect.OracleDialect</property>
      

       <
    property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
      
    <property name="connection.url">jdbc:oracle:thin:@localhost:1521:test</property>    
      
    <property name="connection.username">ora</property>
      
    <property name="connection.password"></property>
        Informix:
       <property name="dialect">org.hibernate.dialect.InformixDialect</property>
      

       <
    property name="connection.driver_class">com.informix.jdbc.IfxDriver</property>
      
    <property name="connection.url">jdbc:informix-sqli://localhost:1526/test:informixserver=server1</property>    
      
    <property name="connection.username">root</property>
      
    <property name="connection.password"></property>  
      
    <property name="connection.encoding">true</property>
        Sybase (via jTDS):
       <property name="dialect">org.hibernate.dialect.SybaseDialect</property>
      
       <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
      
    <property name="connection.url">jdbc:jtds:sybase://localhost:7100/test;useCursors=true</property>    
      
    <property name="connection.username">root</property>
      
    <property name="connection.password"></property>
        PostgreSQL:
       <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
      
       <property name="connection.driver_class">org.postgresql.Driver</property>
      
    <property name="connection.url">jdbc:postgresql://localhost:5432/test</property>    
      
    <property name="connection.username">root</property>
      
    <property name="connection.password"></property>
        MaxDB(SAPDB):
       <property name="dialect">org.hibernate.dialect.SAPDBDialect</property>
      
       <property name="connection.driver_class">com.sap.dbtech.jdbc.DriverSapDB</property>
      
    <property name="connection.url">jdbc:sapdb://localhost/test</property>    
      
    <property name="connection.username">root</property>
      
    <property name="connection.password"></property>
       
    posted on 2007-08-21 10:01 forker 閱讀(4124) 評(píng)論(0)  編輯  收藏 所屬分類: java
    主站蜘蛛池模板: 亚洲无砖砖区免费| 免费A级毛片无码A| **一级一级毛片免费观看| aa级毛片毛片免费观看久| 日韩大片在线永久免费观看网站 | 亚洲精品麻豆av| 凹凸精品视频分类国产品免费| 午夜网站免费版在线观看| 精品久久久久久久免费人妻 | 在线成人精品国产区免费| a级毛片无码免费真人久久 | 亚洲av无码一区二区三区人妖| 亚洲综合国产成人丁香五月激情| 亚洲国产精品免费观看| 亚洲欧美日本韩国| 国产精品无码亚洲一区二区三区| 国产亚洲精品欧洲在线观看| 特级毛片aaaa免费观看| 免费观看的毛片手机视频| 国产在线国偷精品产拍免费| 妞干网手机免费视频| 国产美女做a免费视频软件| 内射无码专区久久亚洲| 亚洲精品高清一二区久久| 亚洲精品字幕在线观看| 亚洲国产精品国自产电影| 在线jyzzjyzz免费视频| 免费jjzz在线播放国产| 最新精品亚洲成a人在线观看| 亚洲αv久久久噜噜噜噜噜| 亚洲综合视频在线观看| 亚洲人成77777在线播放网站不卡| 亚洲精品美女久久久久久久| 污网站免费在线观看| a级毛片免费在线观看| h在线观看视频免费网站| 免费无码又爽又刺激毛片| 亚洲伊人成无码综合网| 久久久亚洲欧洲日产国码aⅴ| 456亚洲人成在线播放网站| 污视频网站在线免费看|