DRUID链接池:java.sql.SQLRecoverableException: 关闭的语句

一、升级1.0.29spring

二、关闭PSCache.app

<property name="poolPreparedStatements" value="false" /> 
  <property name="maxPoolPreparedStatementPerConnectionSize" 
   value="-1" />ui

==================================url

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns=" http://www.springframework.org/schema/beans
 xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:batch=" http://www.springframework.org/schema/batch
 xsi:schemaLocation=" http://www.springframework.org/schema/beans 
           http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">xml

 

 <bean id="propertyConfigure" 
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
  <property name="locations"> 
   <list> 
    <value>./conf/application.properties</value> 
   </list> 
  </property> 
 </bean>get

 

 <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" 
  init-method="init" destroy-method="close"> 
  <property name="driverClassName" value="${jdbc.driverClassName}" /> 
  <property name="url" value="${jdbc.url}" /> 
  <property name="username" value="${jdbc.username}" /> 
  <property name="password" value="${jdbc.password}" /> 
  <!-- 配置初始化大小、最小、最大 --> 
  <property name="initialSize" value="1" /> 
  <property name="minIdle" value="1" /> 
  <property name="maxActive" value="10" />it

  <!-- 配置获取链接等待超时的时间 --> 
  <property name="maxWait" value="10000" />io

  <!-- 配置间隔多久才进行一次检测,检测须要关闭的空闲链接,单位是毫秒 --> 
  <property name="timeBetweenEvictionRunsMillis" value="60000" />table

  <!-- 配置一个链接在池中最小生存的时间,单位是毫秒 --> 
  <property name="minEvictableIdleTimeMillis" value="300000" />class

  <property name="testWhileIdle" value="true" />

  <!-- 这里建议配置为TRUE,防止取到的链接不可用 --> 
  <property name="testOnBorrow" value="true" /> 
  <property name="testOnReturn" value="false" />

  <!-- 打开PSCache,而且指定每一个链接上PSCache的大小 --> 
  <property name="poolPreparedStatements" value="true" /> 
  <property name="maxPoolPreparedStatementPerConnectionSize" 
   value="20" />

  <!-- 这里配置提交方式,默认就是TRUE,能够不用配置 -->

  <property name="defaultAutoCommit" value="true" />

  <!-- 验证链接有效与否的SQL,不一样的数据配置不一样 --> 
  <property name="validationQuery" value="select 1 " /> 
  <property name="filters" value="stat" /> 
  <property name="proxyFilters"> 
   <list> 
    <ref bean="logFilter" /> 
   </list> 
  </property> 
 </bean>

 

 <bean id="logFilter" class="com.alibaba.druid.filter.logging.Slf4jLogFilter"> 
  <property name="statementExecutableSqlLogEnable" value="false" /> 
 </bean>

</beans>

相关文章
相关标签/搜索