<!--MySql 驱动程序 eg. mysql-connector-java-5.0.4-bin.jar-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- JDBC URL -->
<property name="connection.url">jdbc:mysql://localhost/dbname?characterEncoding=gb2312</property>
<!-- 数据库用户名-->
<property name="connection.username">root</property>
<!-- 数据库密码-->
<property name="connection.password">root</property>
<!--Sql Server 驱动程序 eg. jtds-1.2.jar-->
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<!-- JDBC URL -->
<property name="connection.url">jdbc:jtds:sqlserver://localhost:1433;DatabaseName=dbname</property>
<!-- 数据库用户名-->
<property name="connection.username">sa</property>
<!-- 数据库密码-->
<property name="connection.password"></property>
<!--Oracle 驱动程序 ojdbc14.jar-->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<!-- JDBC URL -->
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:dbname</property>
<!-- 数据库用户名-->
<property name="connection.username">test</property>
<!-- 数据库密码-->
<property name="connection.password">test</property>
如果出现如下错误,则可能是Hibernate SQL方言 (hibernate.dialect)设置不正确。
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]'last_insert_id' 不是可以识别的 函数名。
RDBMS
方言
DB2 |
org.hibernate.dialect.DB2Dialect |
DB2 AS/400 |
org.hibernate.dialect.DB2400Dialect |
DB2 OS390 |
org.hibernate.dialect.DB2390Dialect |
PostgreSQL |
org.hibernate.dialect.PostgreSQLDialect |
MySQL |
org.hibernate.dialect.MySQLDialect |
MySQL with InnoDB |
org.hibernate.dialect.MySQLInnoDBDialect |
MySQL with MyISAM |
org.hibernate.dialect.MySQLMyISAMDialect |
Oracle (any version) |
org.hibernate.dialect.OracleDialect |
Oracle 9i/10g |
org.hibernate.dialect.Oracle9Dialect |
Sybase |
org.hibernate.dialect.SybaseDialect |
Sybase Anywhere |
org.hibernate.dialect.SybaseAnywhereDialect |
Microsoft SQL Server |
org.hibernate.dialect.SQLServerDialect |
SAP DB |
org.hibernate.dialect.SAPDBDialect |
Informix |
org.hibernate.dialect.InformixDialect |
HypersonicSQL |
org.hibernate.dialect.HSQLDialect |
Ingres |
org.hibernate.dialect.IngresDialect |
Progress |
org.hibernate.dialect.ProgressDialect |
Mckoi SQL |
org.hibernate.dialect.MckoiDialect |
Interbase |
org.hibernate.dialect.InterbaseDialect |
Pointbase |
org.hibernate.dialect.PointbaseDialect |
FrontBase |
org.hibernate.dialect.FrontbaseDialect |
Firebird |
org.hibernate.dialect.FirebirdDialect |
分享到:
相关推荐
Hibernate 不同数据库的连接及SQL方言,Hibernate 不同数据库的连接及SQL方言,Hibernate 不同数据库的连接及SQL方言,Hibernate 不同数据库的连接及SQL方言,
Hibernate不同数据库的连接及SQL方言 在Hibernate中,连接不同的数据库需要使用不同的数据库连接驱动程序和SQL方言。下面我们将详细介绍如何在Hibernate中连接不同的数据库。 首先,Hibernate提供了一些基本的...
Hibernate不同数据库的连接及SQL方言.pdf
在 Java 应用程序中,需要使用 JDBC 驱动来连接 SQLServer 数据库。JDBC 驱动需要配置 SSH tunnelling,以便通过 SSH 服务器连接数据库。 4. 配置 Hibernate Hibernate 是一个流行的 ORM 框架,用于将 Java 对象...
sql方言: RDBMS 方言 DB2 org.hibernate.dialect.DB2Dialect DB2 AS/400 org.hibernate.dialect.DB2400Dialect DB2 OS390 org.hibernate.dialect.DB2390Dialect PostgreSQL org.hibernate.dialect....
hibernate.dialect = org.hibernate.dialect.MySQLDialect //指定数据库使用的sql方言(oracle、mysql) hibernate.connection.driver_class=com.mysql.jdbc.Driver //指定数据库的驱动程序 hibernate.connection....
– SQL方言,这边设定的是MySQL –> ”dialect”>net.sf.hibernate.dialect.MySQLDialect</property> <!– 一次读的数据库记录数 –> ”jdbc.fetch_size”>50 <!– 设定对数据库进行批量删除 –> ”jdbc.batch_...
3.8. Hibernate SQL方言 (hibernate.dialect) 3.9. Hibernate日志类别 3.10. JTA TransactionManagers 9.1. 继承映射特性(Features of inheritance mappings) 16.1. 别名注射(alias injection names) 19.1. ...
hibernate配置文件 里面提供了连接数据库 数据库使用的方言 是否打印SQL语句 sql语句的格式 以及对象-关系映射文件的地址等
Hibernate.dialect 属性用于指定 Hibernate 的数据库 dialect(方言),该属性的值是一个 Hibernate Dialect 类名,例如 org.hibernate.dialect.OracleDialect。该属性的作用是允许 Hibernate 针对特定的关系数据库...
抽取出了数据库的抽象:方言 缺点: 1.不能干预sql语句的生成 2.一个项目中,如果对sql语句的优化要求比较高,不适合用hibernate 3.如果一张表中有上亿级别的数据量,也不适合用hibernate(数据库读写分离,分库...
query.setFirstResult()是数据库SQL语句实现。 2.你说是在数据库就分页好呢?还是把结果集都取到内存再分页好呢?(应该是在数据库就分了好些吧,但是如果在内存分页的话,换页的时候是不是更快一些呢?) 3.在...
这是与数据库服务的兼容的方言。 SpannerDialect使用标准的Hibernate和Java Persistence注释为大多数常见的实体类型和关系生成SQL,DML和DDL语句。 由于Cloud Spanner的独特功能和局限性,请参见以下各节以了解有关...
3.8. Hibernate SQL方言 (hibernate.dialect) 3.9. Hibernate日志类别 3.10. JTA TransactionManagers 9.1. 继承映射特性(Features of inheritance mappings) 16.1. 别名注射(alias injection names) 19.1. ...
3.8. Hibernate SQL方言 (hibernate.dialect) 3.9. Hibernate日志类别 3.10. JTA TransactionManagers 9.1. 继承映射特性(Features of inheritance mappings) 16.1. 别名注射(alias injection names) 19.1. ...
3.8. Hibernate SQL方言 (hibernate.dialect) 3.9. Hibernate日志类别 3.10. JTA TransactionManagers 9.1. 继承映射特性(Features of inheritance mappings) 16.1. 别名注射(alias injection names) 19.1. ...
* 灵活性:Hibernate 支持多种关系数据库,包括 MySQL、Oracle、SQL Server 等。 * 易用性:Hibernate 提供了简洁易用的 API,易于开发者使用。 Hibernate 的配置 Hibernate 的配置文件是 hibernate.cfg.xml,用于...
3.4.1. SQL方言 3.4.2. 外连接抓取(Outer Join Fetching) 3.4.3. 二进制流 (Binary Streams) 3.4.4. 二级缓存与查询缓存 3.4.5. 查询语言中的替换 3.4.6. Hibernate的统计(statistics)机制 3.5. 日志 3.6. ...
SQL Dialects SQL 方言 3.5.2. 外连接抓取(Outer Join Fetching ) 3.5.3. 二进制流 3.5.4. 自定义CacheProvider 3.5.5. 事务策略配置 3.5.6. 绑定SessionFactory到JNDI 3.5.7. 查询语言替换 ...
--数据库方言(数据库类型)--> <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property> <!--数据库驱动类名--> <property name="connection.url">jdbc:oracle:thin:@IP:port:...