博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
各数据库连接maven配置
阅读量:5166 次
发布时间:2019-06-13

本文共 4242 字,大约阅读时间需要 14 分钟。

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

MySQL throws an EOFException when the database connection has been closed after the lease has expired, but it works again on subsequent requests.

There is a reported issue with DBCP and the MySQL driver. Check the JIRA issue for more info and a possible solution

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

转载于:https://www.cnblogs.com/kluan/p/6010110.html

你可能感兴趣的文章
codeforce好地方啊 Bear and Elections *
查看>>
破解wifi_失败
查看>>
20145332 《网络攻防》 逆向与Bof实验
查看>>
子元素设置margin-top,父元素无法将margin-top包含在父容器的原因及解决办法
查看>>
Centos服务器搭建(6)——安装JDK
查看>>
C语言_第二讲_规范以及常用数据类型
查看>>
RIP的缺点
查看>>
Unity最优化摘要
查看>>
类模板使用说明
查看>>
Redis源代码分析(一)--Redis结构解析
查看>>
Flex父子窗体相互调用
查看>>
改动网卡IP信息
查看>>
【Java】国内maven私服
查看>>
第三方开源水面波浪波形view:WaveView
查看>>
POJ 2251 Dungeon Master(3D迷宫 bfs)
查看>>
Linux查看和编辑文件
查看>>
MVC之 自定义过滤器(Filter)
查看>>
loadrunner controller:设置多个load generator
查看>>
关于self.用法的一些总结
查看>>
[原创.数据可视化系列之十三]idw反距离权重插值算法的javascript代码实现
查看>>