hibernate连接数据库的配置
2010-09-28 11:13
363 查看
连接mysql的配置
连接sql server 2005的配置
连接oracle9i的配置
<!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.url">jdbc:mysql://localhost/hibernate_second</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">1234</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> <mapping resource="hibernate/User.hbm.xml"/> </session-factory> </hibernate-configuration>
连接sql server 2005的配置
<?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="hibernate.hbm2ddl.auto">update</property> <property name="dialect"> org.hibernate.dialect.SQLServerDialect </property> <property name="connection.url"> jdbc:sqlserver://localhost:1433;databaseName=Test </property> <property name="connection.username">sa</property> <property name="connection.password">sa</property> <property name="connection.driver_class"> com.microsoft.sqlserver.jdbc.SQLServerDriver </property> <property name="show_sql">true</property> <mapping resource="com/visionsky/domain/User.hbm.xml"/> </session-factory> </hibernate-configuration>
连接oracle9i的配置
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!--程序执行的时候是否显示真正的sql语句--> <property name="show_sql">true</property> <!--使用的SQL对应的“方言”,此处是Oracle9的“方言”--> <property name="dialect">org.hibernate.dialect.Oracle9Dialect </property> <!--连接数据库的Driver--> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </property> <!--数据库连接url--> <property name="connection.url"> jdbc:oracle:thin:@localhost:1521:nitpro </property> <!--用户名--> <property name="connection.username">system</property> <!--密码--> <property name="connection.password">manager</property> </session-factory> </hibernate-configuration>
相关文章推荐
- Hibernate与各种数据库连接的配置
- Spring,hibernate数据库连接配置
- spring配置文件applicationContext.xml配置hibernate的连接数据库信息及sessionFactory创建方式
- hibernate连接多个数据库,如何动态切换(我一般用配置文件动态切换)
- hibernate的配置——数据库的基本连接信息
- Hibernate与各种数据库连接的配置
- Hibernate配置XML连接数据库
- Spring\Hibernate\Tomcat配置数据库连接
- 数据库连接池概念、种类、配置(三)(Spring\Hibernate\Tomcat配置数据库连接)
- 数据库连接池概念、种类、配置(三)(Spring\Hibernate\Tomcat配置数据库连接)
- 详解在Hibernate中配置数据库方言的作用和好处以及各种数据库的方言连接
- 如何配置Hibernate连接oracle12c 的PDB和CDB数据库
- 详解在Hibernate中配置数据库方言的作用和好处以及各种数据库的方言连接
- Hibernate连接8种常见的数据库配置方式
- Hibernate配置不同数据库的连接及SQL方言
- Hibernate连接各种数据库的配置
- 数据库连接池概念、种类、配置(三)(Spring\Hibernate\Tomcat配置数据库连接)
- Hibernate连接6种常见的数据库配置方式
- Hibernate与各种数据库连接的配置
- Eclipse(LUNA4.4.2)配置hibernate(4.3.8)连接数据库并自动生成代码