一:场景

tomcat数据源连接oracle数据库,不断出现连接数爆满,导致数据库挂掉

二:解决办法

参考文章 http://www.tuicool.com/articles/AbUNj27

也就是在tomcat context.xml配置文件中,添加三个属性

maxWait="2000" //单位毫秒

removeAbandoned="true"

removeAbandonedTimeout="180" //单位秒

即增加连接池回收机制,活动连接,在超过时间内,没有使用,会被自动回收