Hibernate连接MySql数据库时 Hibernate.cfg.xml配置文件

来源:互联网 发布:网络键盘 编辑:程序博客网 时间:2024/04/27 14:50
<?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"><!-- Generated by MyEclipse Hibernate Tools.                   --><hibernate-configuration><session-factory>    <!-- 方言类 --><property name="dialect">org.hibernate.dialect.MySQLDialect</property><property name="connection.url">    <!--连接MySQL的IP地址及端口号,注意MySQL的默认远程连接是关闭的-->jdbc:mysql://127.0.0.1:3306/DatabaseName</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="myeclipse.connection.profile">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></session-factory></hibernate-configuration>

原创粉丝点击