各种数据库Hibernate链接配置

Derby

db driver maven dependency
<dependency>
        <groupId>org.apache.derby</groupId>
        <artifactId>derbyclient</artifactId>
        <version>10.2.2.0</version>
</dependency>
hibernate.properties
hibernate.dialect=org.hibernate.dialect.DerbyDialect
hibernate.connection.driver_class=org.apache.derby.jdbc.ClientDriver
hibernate.connection.url=jdbc:derby://localhost/trails;create=true
hibernate.connection.username=any
hibernate.connection.password=value
hibernate.hbm2ddl.auto=update

MySQL

db driver maven dependency
<dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.0.5</version>
</dependency>
hibernate.properties
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost/trails?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8
hibernate.connection.username=root
hibernate.connection.password=
hibernate.hbm2ddl.auto=update

H2

db driver maven dependency
<dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.0.20070304</version>
</dependency>
hibernate.dialect=org.hibernate.dialect.H2Dialect
hibernate.connection.driver_class=org.h2.Driver
hibernate.connection.url=jdbc:h2:trails
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.hbm2ddl.auto=update

Oracle

db driver maven dependency
<dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId>
        <version>10.2.0.2.0</version>
</dependency>
hibernate.properties
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
hibernate.connection.driver_class=oracle.jdbc.OracleDriver
hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:XE
hibernate.connection.username=system
hibernate.connection.password=system
hibernate.hbm2ddl.auto=update
 
# The Oracle JDBC driver doesn't like prepared statement caching very much.
hibernate.statement_cache.size=0
# or baching with BLOBs very much.
hibernate.jdbc.batch_size=0
 
# After a while, Oracle throws this exception: too many open cursors
# Disable PreparedStatement caching for the connection pool too.
# http://www.hibernate.org/120.html#A10
hibernate.dbcp.ps.maxIdle = 0
 
# Stoping hibernate from using the column-names in queries to retrieve data from the resultsets
# More info in http://www.jroller.com/page/dashorst?entry=hibernate_3_1_something_performance1
hibernate.jdbc.wrap_result_sets=true

PostgreSQL.

db driver maven dependency
<dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>8.2-504.jdbc3</version>
</dependency>
hibernate.properties
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.url=jdbc:postgresql://localhost/trails
hibernate.connection.username=postgres
hibernate.connection.password=postgres
hibernate.hbm2ddl.auto=update

Microsoft SQL Server

db driver maven dependency
<dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>jtds</artifactId>
        <version>1.2</version>
</dependency>
hibernate.properties
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/trails
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.hbm2ddl.auto=update

HSQLDB

db driver maven dependency
<dependency>
        <groupId>hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>1.8.0.7</version>
</dependency>
hibernate.properties
hibernate.dialect=org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class=org.hsqldb.jdbcDriver
hibernate.connection.url=jdbc:hsqldb:trails;shutdown=true
hibernate.connection.username=sa
hibernate.connection.password=
hibernate.hbm2ddl.auto=update
手动安装Maven依赖包
例如要安装这样一个依赖到maven本地仓库:
1.将此依赖添加到项目的pom.xml
<dependency>
   <groupId>com.microsoft.sqlserver</groupId>
   <artifactId>sqljdbc4</artifactId>
   <version>3.0</version>
</dependency>
2.在命令行中执行install命令
mvn
install:install-file -Dfile=sqljdbc4-3.0.jar
-DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=3.0
-Dpackaging=jar
3.将sqljdbc4-3.0.jar拷贝到此依赖安装目录
将sqljdbc4-3.0.jar拷贝到X:\Documents and Settings\%USER%\.m2\repository\com\microsoft\sqlserver\sqljdbc4\3.0 中即可.

各种数据库maven的pom文件编写与ibernate链接配置的更多相关文章

  1. maven里面pom文件的各标签介绍

    由于maven在工作中经常使用,但是平时要记的知识点有点多,偶尔回头来看一些东西难免忘记,特此整理一篇笔记,方便大家搜索查询,也方便自己以后查询! 后续碰见其他的标签也会进行更新! maven的pom ...

  2. Maven的POM文件parent节点不可以使用properties里面的变量

    Maven的POM文件parent节点不可以使用properties里面的变量 但是如果在子项目上的parent节点是可以使用父项目里定义的properties变量 如果一开始为单项目,或者最顶层项目 ...

  3. maven在pom文件中引入了icepdf-core包,pom文件却莫名的报错,说jai_core包missing

    maven在pom文件中引入了icepdf-core包,却莫名的报错,说jai_core包missing,把这个jai_core包引入之后还是一样报错,PS:icepdf-core使用的时候不用引用j ...

  4. MyEclipse导入Maven项目pom文件第一行报错,运行Tomcat报Log4j错误--解决方法

    问题描述: 前一段时间电脑第一次导入Maven项目,又是pom文件错,改好后又是运行Tomcat报Log4j错误,一直倒腾了近一个月程序才成功跑起来,太不容易. 也上网查了很长时间,没一个方法能解决我 ...

  5. CoreException: Could not get the value for parameter compilerId for plugin execution default-compile Maven项目pom文件报错,插件引用不到

    CoreException: Could not get the value for parameter compilerId for plugin execution default-compile ...

  6. maven在pom文件中添加你想要的jar包

    概述:POM 文件里面的依赖jar包经常需要添加, 仅需要在google中代码查找 :maven 你需的jar包名称 repository 用了Maven,所需的JAR包就不能再像往常一样,自己找到并 ...

  7. Maven及POM文件

    Maven Maven是基于项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的软件项目管理工具. Logback是由LOG4创始人设计的又一个开源日志组件. 相关链接: Ma ...

  8. maven的pom文件解析及配置

    1.IDEA中的Maven的pom.xml文件,其实比较通俗点介绍功能主要项目引入的jar包,管理配置项目以及一些插件的配置等项目 2.对于pom配置详细介绍,整理如下2篇文档介绍的比较系统全面: h ...

  9. Maven的pom文件内容详细理解

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

随机推荐

  1. .Net上传图片压缩质量,不改变尺寸

    图片上传有很多情况需要考虑,例如:生成缩略图.压缩尺寸.压缩质量.压缩尺寸质量.添加水印等等常见情况.最近遇到图片质量压缩不改变大小的问题,参考:听浪 #region 图片压缩 /// <sum ...

  2. C#Encoding

    1.Encoding (1).如何生成一个Encoding即一种编码 Encoding位于System.Text命名空间下,是一个抽象类,它的派生类如下图: 要实例化一个Encoding一共有以下两种 ...

  3. 自己的Java规范文档

    参考阿里Java规范文档 不建议使用过时方法 泛型需要加上<>,这种方式创建的对象是不推荐的. Map object = new HashMap();//禁止使用 字符串比较时,不需要大小 ...

  4. c语言第一次作业--顺序、分支结构

    1.1思维导图 1.2.1本周学习体会以及代码量学习体会 1.2.2学习体会     因为在暑假时候没有对c语言进行学习,没太关注一些学习资料,一些教学视频也没看,感觉对c语言是陌生的,刚开课的时候自 ...

  5. c语言博客作业01—分支、顺序结构

    1.本章学习总结  1.1 思维导图  1.2本章学习体会及代码量学习体会  1.2.1学习体会 这周 对c语言的学习 明显与其他同学相比较有些滞后,觉得很大原因是暑假没有看教学视频,课前没有预习课本 ...

  6. C#写入文件

    using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\testDir\test2.txt", t ...

  7. java从txt文档读写数据

    package com.abin.facade.ws.mail.function; import java.io.BufferedReader; import java.io.File; import ...

  8. lucene3.0_IndexSearcher排序

    系列汇总: lucene3.0_基础使用及注意事项汇总 IndexSearcher排序 本文主要讲解: 1.IndexSearcher中和排序相关的方法及sort类.SortField类(api级别) ...

  9. mongodb 3.0下载安装、配置及mongodb最新特性、基本命令教程详细介绍

    mongoDB简介(本文由www.169it.com搜集整理) MongoDB是一个高性能,开源,无模式的文档型数据库,是目前在IT行业非常流行的一种非关系型数据库(NoSql).它在许多场景下可用于 ...

  10. 基于openresty配置https访问

    安装方法:http://openresty.org/cn/linux-packages.html 1. openssl的版本信息 [root@localhost conf]# openssl vers ...