Hikaricp简单使用

2017/09/18
Hikaricp简单使用

Hikaricp 替换现有的数据库连接池也是很方便的 没有时间去测试 现贴出简单的配置
如果使用spring,只需要简单的替换
          class="com.zaxxer.hikari.HikariDataSource" destroy-method="shutdown">
       
           
               
               
               
               
               
               
               
               
               
               
           

       

   

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

你可能感兴趣的:(Hikaricp简单使用)