Solo  当前访客:1 登录 注册

喧哗博客-http://blog.xuahua.com

繁华过后的沉寂--技术经验分享
浏览次数: 100,919    文章总数: 91    评论总数: 3
标签:

数据库联接池连接,失效后自动重连参数设置 有更新!

 

二种连接,

1,alibaba出品的数据库连接驱动Druid

<Resource 
         name="jdbc/game"
         factory="com.alibaba.druid.pool.DruidDataSourceFactory"
         auth="Container"
         type="javax.sql.DataSource"
         driverClassName="com.mysql.jdbc.Driver"
         url="jdbc:mysql://xxx:3306/game1?sendStringParametersAsUnicode=false"
         username="game1"
         password="game1"
         maxActive="500"
         maxWait="60000"
         initialSize="100"
         removeabandoned="true"
         removeabandonedtimeout="60"
         timeBetweenEvictionRunsMillis="60000"
         minEvictableIdleTimeMillis="300000"
         validationQuery="select 1"
         testWhileIdle="true"
         testOnReturn="false"
         testOnBorrow="false"
         logabandoned="false"
         poolPreparedStatements="true"
         maxPoolPreparedStatementPerConnectionSize="20"
         filters="stat"/>

 

2,tomcat自带的连接池 org.apache.tomcat.jdbc.pool.DataSourceFactory

 

<Resource name="jdbc/game" auth="Container"
      type="javax.sql.DataSource"
      factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
      testWhileIdle="true"
      testOnBorrow="true"
      testOnReturn="false"
      validationQuery="SELECT 1"
      validationInterval="30000"
      timeBetweenEvictionRunsMillis="30000"
      maxActive="100"
      minIdle="10"
      maxWait="10000"
      initialSize="50"
      removeAbandonedTimeout="60"
      removeAbandoned="true"
      logAbandoned="true"
      minEvictableIdleTimeMillis="30000"
      jmxEnabled="true"
      jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer"
      username="game1"
      password="game1"
      driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://xxx:13306/gametest?sendStringParametersAsUnicode=false"/>

 

 

 

 

 

 

 

 

数据库-改变字符校验规则

ALTER TABLE `t_mem_notify`
MODIFY COLUMN `openid` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL AFTER `result`;

公告

喧哗博客--繁华过后的沉寂--技术经验分享^-^
Copyright (c) 2009-2020, b3log.org & hacpai.com