日期:2014-05-16  浏览次数:20692 次

Hibernate连接mysql数据库配置文件

<!DOCTYPE hibernate-configuration PUBLIC
??? "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
??? "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
??? <session-factory>
??? ??? <!-- 配置数据库连接 -->
??? ??? <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
??? ??? <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test</property>
??? ??? <property name="hibernate.connection.username">root</property>
??? ??? <property name="hibernate.connection.password">root</property>
??? ??? <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>

??? ???
??? ??? <!-- 配置数据源 -->
??? ??? <property name="hibernate.c3p0.max_size">50</property>
??? ??? <property name="hibernate.c3p0.min_size">5</property>
??? ??? <property name="hibernate.c3p0.acquire_increment">5</property>
??? ??? <property name="hibernate.c3p0.max_statements">200</property>
??? ??? <property name="hibernate.c3p0.idle_test_period">3000</property>
??? ??? <property name="hibernate.c3p0.validate">false</property>
??? ??? <property name="hibernate.c3p0.timeout">5000</property>

??? ???
??? ??? <!-- 是否打印SQL语句 -->
??? ??? <property name="hibernate.show_sql">true</property>
??? ???
??? ??? <!-- 注册映射关系 -->
??? ??? <mapping resource="vo/User.hbm.xml"/>
??? ??? <mapping resource="vo/Login.hbm.xml"/>

??? </session-factory>
</hibernate-configuration>