cashplk
6/6/2013 - 11:13 AM

druid config file

<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
  		<property name="url">
					<value>jdbc:mysql://XXXX</value>
			</property>
			<property name="username" value="XXX"/>
			<property name="password" value="XXX"/>
			
			<!-- 配置初始化大小、最小、最大 -->
			<property name="initialSize" value="100"/>
			<property name="minIdle" value="100"/>
			<property name="maxActive" value="150"/>
			
			<!-- 配置获取连接等待超时的时间 -->
			<property name="maxWait" value="60000" />
			
			<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
    		<property name="timeBetweenEvictionRunsMillis" value="60000" />
			
			<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
  			<property name="minEvictableIdleTimeMillis" value="180000" />
  			
			<property name="testWhileIdle" value="true" />
			<property name="testOnBorrow" value="false"/>
			
			<property name="maxPoolPreparedStatementPerConnectionSize" value="0"/>
			<property name="connectionErrorRetryAttempts" value="30"/>
			<property name="breakAfterAcquireFailure" value="false"/>
			
			<!-- 配置监控统计拦截的filters -->
			<property name="filters" value="stat" />
			<property name="connectionProperties" value="druid.stat.slowSqlMillis=1000" />
	</bean>