Hibernate的配置文件
来源:互联网 发布:java 99乘法表 最简单 编辑:程序博客网 时间:2024/04/30 04:22
必选项:
hibernate.connection.username:访问的数据库用户名
hibernate.connection.password:访问的数据库密码
hibernate.connection.url:连接数据库的url
hibernate.connection.driver_class:连接数据库使用的驱动程序
hibernate.dialect:连接数据库所使用的方言
可选项:
show_sql:显示执行的sql语句
常见数据库的驱动程序、url、方言
1.mysql驱动程序为:"com.mysql.jdbc.Driver", url为:"jdbc:mysql://localhost:3306/[DBName]"。方言:org.hibernate.dialect.MySQLDialect
2.oracle
驱动程序为:"oracle.jdbc.driver.OracleDriver", url为:"jdbc:oracle:thin:@[ip]:1521:[DBName]“方言:org.hibernate.dialect.OracleDialect
3.sql server
驱动程序为:"com.microsoft.jdbc.sqlserver.SQLServerDriver", url为:"jdbc:microsoft:sqlserver://[IP]:1433;DatabaseName=[DBName],方言:org.hibernate.dialect.SQLServerDialect
mysql的一个配置样例
<?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><!-- hibernate方言 --><property name="dialect">org.hibernate.dialect.MySQLDialect</property><!-- hibernate连接的数据库url --><property name="connection.url">jdbc:mysql://localhost/test</property><!-- hibernate数据库JDBC驱动 --><property name="connection.driver_class">com.mysql.jdbc.Driver</property><!-- hibernate连接的数据库用户名和密码 --><property name="connection.username">root</property><property name="connection.password">han</property><property name="hibernate.show_sql">true </property> <mapping resource="test/book.hbm.xml"/></session-factory></hibernate-configuration>oracle的一个配置样例
<?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><!-- hibernate方言 --><property name="dialect">org.hibernate.dialect.OracleDialect</property><!-- hibernate连接的数据库url --><property name="connection.url">jdbc:oracle:thin:@10.105.240.9:1521:ORCL</property><!-- hibernate数据库JDBC驱动 --><property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property><!-- hibernate连接的数据库用户名和密码 --><property name="connection.username">grp_9_7</property><property name="connection.password">grp97</property><property name="hibernate.show_sql">true </property> <property name="hibernate.query.factory_class"> org.hibernate.hql.classic.ClassicQueryTranslatorFactory </property><mapping resource="DAO/Assistant.hbm.xml"/><mapping resource="DAO/Course.hbm.xml"/><mapping resource="DAO/Homework.hbm.xml"/><mapping resource="DAO/Student.hbm.xml"/><mapping resource="DAO/Submittedwork.hbm.xml"/><mapping resource="DAO/Teacher.hbm.xml"/><mapping resource="DAO/Group.hbm.xml"/></session-factory></hibernate-configuration>
0 0
- Hibernate的hibernate-mapping配置文件
- Hibernate的配置文件
- Hibernate配置文件的困惑
- hibernate的配置文件
- 基本的Hibernate配置文件
- Hibernate的配置文件
- Hibernate的配置文件
- hibernate配置文件的问题
- 创建Hibernate的配置文件
- Hibernate的配置文件
- Hibernate的配置文件
- hibernate的配置文件
- hibernate的映射配置文件
- hibernate的配置文件详解
- Hibernate 的配置文件
- 【配置文件】MySQL的hibernate.cfg.xml配置文件
- hibernate的配置文件的配置
- hibernate的hibernate.cfg.xml配置文件
- 黑马程序员--泛型详解和学习心得一
- fzu 2107 Hua Rong Dao(回溯)
- 摄像头FAQ
- 百度降权查询及诊断恢复
- 黑马程序员--Annotation(注解)学习总结和心得
- Hibernate的配置文件
- leetcode-add-two-numbers
- quick-cocos2dx display
- DLNA介绍(包括UPnP,2011/6/20 更新)
- 永远不要在Linux执行的10个最危险的命令
- QThread 解析
- animationSet.setFillAfter方法无效
- Linux系统安装Appach 2.4.6
- oarcle数据库dblink 创建