Hibernate配置数据源

Hibernate配置各种数据源:

 

  1. <?xml version='1.0' encoding='UTF-8'?>  
  2. <!DOCTYPE hibernate-configuration PUBLIC   
  3.           "-//Hibernate/Hibernate Configuration DTD 3.0//EN"   
  4.           "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">  
  5.   
  6. <!-- Generated by MyEclipse Hibernate Tools.                   -->  
  7. <hibernate-configuration>  
  8.   
  9. <session-factory>  
  10.     <property name="dialect">  
  11.         org.hibernate.dialect.MySQLDialect   
  12.         <!--   
  13.             Oracle  org.hibernate.dialect.Oracle9Dialect   
  14.             Sqlserver  org.hibernate.dialect.SQLServerDialect   
  15.             MySQL  org.hibernate.dialect.MySQLDialect   
  16.         -->  
  17.     </property>  
  18.     <property name="connection.url">  
  19.         jdbc:mysql://192.168.1.111:3306/test   
  20.         <!--    
  21.             Oracle:  jdbc:oracle:thin:@<server>[:<1521>]:<database_name>  
  22.             Sqlserver  jdbc:sqlserver://<server_name>:<port>[;databaseName=<dbname>]   
  23.             MySQL  jdbc:mysql://<hostname>[<:3306>]/<dbname>  
  24.         -->  
  25.     </property>  
  26.     <property name="connection.username">shaoxing</property>  
  27.     <property name="connection.password">shaoxing</property>  
  28.     <property name="connection.driver_class">  
  29.         com.mysql.jdbc.Driver   
  30.     </property>  
  31.     <mapping resource="com/xing/bean/User.hbm.xml" />  
  32.   
  33. </session-factory>  
  34.   
  35. </hibernate-configuration>  

 

 

转载至:http://dazhilao.iteye.com/blog/619422

你可能感兴趣的:(Hibernate,Blog)