读书人

DBCP 配备连接参数详解

发布时间: 2013-07-09 09:50:47 作者: rapoo

DBCP 配置连接参数详解

  1. <!--?数据源1?-->??
  2. ????<bean?id="dataSource"??
  3. ??????????class="org.apache.commons.dbcp.BasicDataSource"??
  4. ??????????destroy-method="close">??
  5. ????????<property?name="driverClassName"?value="com.mysql.jdbc.Driver"/>??
  6. ????????<property?name="url"?value="jdbc:mysql://192.168.0.109:3306/test?useUnicode=true&characterEncoding=UTF-8"/>??
  7. ????????<property?name="username"?value="root"/>??
  8. ????????<property?name="password"?value="root"/>??
  9. ????????<!--maxActive:?最大连接数量-->????
  10. ????????<property?name="maxActive"?value="150"/>??
  11. ????????<!--minIdle:?最小空闲连接-->????
  12. ????????<property?name="minIdle"?value="5"/>??
  13. ????????<!--maxIdle:?最大空闲连接-->????
  14. ????????<property?name="maxIdle"?value="20"/>??
  15. ????????<!--initialSize:?初始化连接-->????
  16. ????????<property?name="initialSize"?value="30"/>??
  17. ????????<!--?连接被泄露时是否打印?-->??
  18. ????????<property?name="logAbandoned"?value="true"/>??
  19. ????????<!--removeAbandoned:?是否自动回收超时连接-->????
  20. ????????<property?name="removeAbandoned"??value="true"/>??
  21. ????????<!--removeAbandonedTimeout:?超时时间(以秒数为单位)-->????
  22. ????????<property?name="removeAbandonedTimeout"?value="10"/>??
  23. ????????<!--maxWait:?超时等待时间以毫秒为单位?1000等于60秒-->??
  24. ????????<property?name="maxWait"?value="1000"/>??
  25. ????????<!--?在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位.?-->??
  26. ????????<property?name="timeBetweenEvictionRunsMillis"?value="10000"/>??
  27. ????????<!--??在每次空闲连接回收器线程(如果有)运行时检查的连接数量?-->??
  28. ????????<property?name="numTestsPerEvictionRun"?value="10"/>??
  29. ????????<!--?1000?*?60?*?30??连接在池中保持空闲而不被空闲连接回收器线程-->??
  30. ????????<property?name="minEvictableIdleTimeMillis"?value="10000"/>??
  31. ????<property?name="validationQuery"?value="SELECT?NOW()?FROM?DUAL"/>??
  32. ????</bean>??

读书人网 >其他数据库

热点推荐