Hikaricp简单使用

Hikaricp 替换现有的数据库连接池也是很方便的 没有时间去测试   现贴出简单的配置  

如果使用spring,只需要简单的替换

1<bean id="hikariDataSource" 2 class="com.zaxxer.hikari.HikariDataSource" destroy-method="shutdown"> 3 <constructor-arg> 4 <bean class="com.zaxxer.hikari.HikariConfig"> 5 <property name="driverClassName" value="${hikaricp.jdbc.driverClassName}"/> 6 <property name="jdbcUrl" value="${hikaricp.url}"/> 7 <property name="username" value="${hikaricp.username}"/> 8 <property name="password" value="${hikaricp.password}"/> 9 <property name="connectionTestQuery" value="${hikaricp.connectionTestQuery}"/> 10 <property name="connectionTimeout" value="${hikaricp.connectionTimeout}"/> 11 <property name="idleTimeout" value="${hikaricp.idleTimeout}"/> 12 <property name="maxLifetime" value="${hikaricp.maxLifetime}"/> 13 <property name="maximumPoolSize" value="${hikaricp.maximumPoolSize}"/> 14 <property name="minimumIdle" value="${hikaricp.minimumIdle}"/> 15 </bean> 16 </constructor-arg> 17 </bean>

引入的properties文件:

1#HikariDataSource config 2hikaricp.jdbc.driverClassName=com.mysql.jdbc.Driver 3hikaricp.url= jdbc:mysql://127.0.0.1:3306/dcserver38?useUnicode=true&amp;characterEncoding=UTF-8 4hikaricp.quratz_jdbc.url=jdbc:mysql://127.0.0.1:3306/quartz?useUnicode=true&amp;characterEncoding=UTF-8 5hikaricp.username=root 6hikaricp.password=123456 7hikaricp.connectionTestQuery= SELECT 1 8hikaricp.connectionTimeout = 30000 9#This property controls the maximum amount of time (in milliseconds)\ 10# that a connection is allowed to sit idle in the pool. Whether a connection is retired \ 11# as idle or not is subject to a maximum variation of +30 seconds, and average variation of +15 seconds.\ 12# A connection will never be retired as idle before this timeout. A value of 0 means that idle connections \ 13# are never removed from the pool. Default: 600000 (10 minutes) 14hikaricp.idleTimeout = 600000 15#This property controls the maximum lifetime of a connection in the pool. When a connection reaches this timeout, \ 16# even if recently used, it will be retired from the pool. An in-use connection will never be retired, \ 17# only when it is idle will it be removed. We strongly recommend setting this value, and using something \ 18# reasonable like 30 minutes or 1 hour. A value of 0 indicates no maximum lifetime (infinite lifetime), s\ 19# ubject of course to the idleTimeout setting. Default: 1800000 (30 minutes) 20hikaricp.maxLifetime = 1800000 21#池连接数量 22hikaricp.maximumPoolSize =100 23hikaricp.minimumIdle =100

是否真正好用 为开发者带来便利还有带长期的测试  本身这个项目年限也没有多久更多信息 :

https://github.com/brettwooldridge/HikariCP

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

swap空间的增减方法

(1)增大swap空间去激活swap交换区:swapoff v /dev/vg00/lvswap扩展交换lv:lvextend L 10G /dev/vg00/lvswap重新生成swap交换区:mkswap /dev/vg00/lvswap激活新生成的交换区:swapon v /dev/vg00/lvswap