本文共 1689 字,大约阅读时间需要 5 分钟。
新官方支持将com.mysql.jdbc.Driver改为com.mysql.cj.jdbc.Driver,此外mysql8.0是不需要建立ssl连接的,你需要显示关闭,即url中的useSSL=false;最后你需要设置CST,CST可视为美国、澳大利亚、古巴或中国的标准时间。serverTimezone是设置时区的.
#jdbc.driver=com.mysql.jdbc.Driverjdbc.driver=com.mysql.cj.jdbc.Driver##测试库jdbc.url=jdbc:mysql://localhost:3306/xiaoye?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=UTC&useSSL=falsejdbc.database2.url=jdbc:mysql://localhost:3306/xiaoye?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false&allowMultiQueries=true&serverTimezone=UTC&useSSL=false## 通用设置jdbc.username=rootjdbc.password=root#------------------------------------------------------------------------------------------#配置扩展插件 监控统计用filters:stat 日志用filters:log4j 防御sql注入用filters:wallfilters=stat,slf4j,config#最大连接池数量 初始化建立物理连接的个数 获取连接时最长的等待时间 最小连接池数量 maxIdle已经弃用maxActive=300initialSize=1maxWait=60000minIdle=10#maxIdle:15#有两个含义 1.Destroy 线程会检测连接的时间 2.testWhileIdle的判断依据timeBetweenEvictionRunsMillis=60000#Destory线程中如果检测到当前连接的最后活跃时间和当前时间的差值大于minEvictableIdleTimeMillis,则关闭当前连接minEvictableIdleTimeMillis=300000#用来检测连接是否的sql,要求是一个查询语句。在mysql中通常设置为SELECT 'X'validationQuery=SELECT 'x'#申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery连接是否有效testWhileIdle=true#申请连接时执行validationQuery检测连接是否有效 这个配置会降低性能testOnBorrow=false#归还连接时执行validationQuery检测连接是否有效 这个配置会降低性能testOnReturn=false#要启用PSCache,必须配置大于0,当大于0时,poolPreparedStatements自动触发修改为truemaxOpenPreparedStatements=20#对于建立连接超过removeAbandonedTimeout的连接强制关闭removeAbandoned=true#指定连接建立多长就被强制关闭removeAlogAbandoremoveAbandonednedremoveAbandonedTimeout=1800#指定发生removeabandoned时,是否记录当前线程的堆栈信息到日志中logAbandoned=true
转载地址:http://huzob.baihongyu.com/