Hibernate连接mysql数据库的配置

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <!-- 方言类 -->
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="connection.url">
            jdbc:mysql://localhost:3306/test
        </property>
        <!--连接MySQL的用户名 -->
        <property name="connection.username">root</property>
        <!--连接MySQL的密码 -->
        <property name="connection.password">root</property>
        <!--连接MySQL的驱动类名 -->
        <property name="connection.driver_class">
            com.mysql.jdbc.Driver
        </property>
        <property name="current_session_context_class">thread</property>
        <!--以格式良好的方式显示SQL语句 -->
        <property name="format_sql">true</property>
        <!--显示SQL语句 -->
        <property name="show_sql">true</property>
        <!-- 表结构更新机制 -->
        <property name="hbm2ddl.auto">update</property>
        <mapping resource="cn/entity/student.hbm.xml"/>
    </session-factory>
</hibernate-configuration>
上一篇:jmeter之连接mysql和SQL Server配置


下一篇:使用ABP EntityFramework连接MySQL数据库