hibernate中连接SQLServer2008的配置文件hibernate.cfg.xml
来源:互联网 发布:大赢家缩水软件 编辑:程序博客网 时间:2024/05/18 01:41
hibernate.cfg.xml中的文件内容如下:
<?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">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<!-- <property name="connection.driver_class">org.hsqldb.jdbcDriver</property> -->
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
连接sqlserver2008的类库文件,务必写正确
<!-- <property name="connection.url">jdbc:hsqldb:hsql://localhost</property> -->
<property name="connection.url">jdbc:sqlserver://localhost:1433;DatabaseName=hibernate</property>
连接sqlserver2008的路径文件:除数据库名之外,其他都一样(除非你改了数据库的端口号)
当时因为我把数据库名敲错了一个字母,几乎把一个项目中的所有配置文件全都检查一遍,汗..............
敲代码一定要仔细仔细再仔细
<property name="connection.username">sa</property>
<property name="connection.password">123456</property>
<!-- JDBC connection pool (use the built-in) -->
<!-- <property name="connection.pool_size">1</property> -->
<!-- SQL dialect -->
<!-- <property name="dialect">org.hibernate.dialect.HSQLDialect</property> -->
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
查hibernate的API文档就可以
<!-- Enable Hibernate's automatic session context management -->
<!-- <property name="current_session_context_class">thread</property> -->
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<!-- <property name="hbm2ddl.auto">update</property> -->
<!-- 去哪里找配置文件 -->
<!-- <mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/> -->
<mapping resource="com/bjsxt/hibernate/model/Student.hbm.xml"/>
</session-factory>
</hibernate-configuration>
- hibernate中连接SQLServer2008的配置文件hibernate.cfg.xml
- Hibernate中配置文件hibernate.cfg.xml详解
- hibernate的hibernate.cfg.xml配置文件
- 深入Hibernate 的配置文件hibernate.cfg.xml
- Hibernate的配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate的主配置文件hibernate.cfg.xml
- Hibernate配置文件hibernate.cfg.xml的详解
- spring集成hibernate.cfg.xml连接sqlserver的配置文件
- hibernate.cfg.xml 配置文件
- hibernate.cfg.xml配置文件
- hibernate.cfg.xml配置文件
- hibernate.cfg.xml配置文件
- Hibernate.cfg.xml配置文件
- hdu 5105 高中数学题分情况讨论
- GPU 2012年10月 性能排名
- Java String and Date convert
- Linux下C/C++编译器GCC/G++使用简介
- mssqlserver 复制拷贝附件sql脚本(三)之异地服务器导出
- hibernate中连接SQLServer2008的配置文件hibernate.cfg.xml
- Android ActionBar应用实战,高仿微信主界面的设计
- WebView功能详解
- Android Studio使用教程(一)
- GPU 2014年4月 性能排名
- Win8 .NET Framework 3.5 离线安装包 中文版
- Factorial Trailing Zeroes
- Ant on a Chessboard
- intellij导入gradle android工程一直加载问题解决