1、 修改原来的 dataSource
< bean id = "dataSource"
class = "org.logicalcobwebs.proxool.ProxoolDataSource" >
< property name = "driver" >
< value > ${proxool.driver} </ value >
</ property >
< property name = "user" value = "share" ></ property >
< property name = "password" >
< value > ${proxool.password} </ value >
</ property >
< property name = "driverUrl" >
< value > ${proxool.url} </ value >
</ property >
< property name = "alias" >
< value > ${proxool.alias} </ value >
</ property >
< property name = "houseKeepingSleepTime" >
< value > ${proxool.houseKeepingSleepTime} </ value >
</ property >
< property name = "prototypeCount" >
< value > ${proxool.prototypeCount} </ value >
</ property >
< property name = "maximumConnectionCount" >
< value > ${proxool.maximumConnectionCount} </ value >
</ property >
< property name = "minimumConnectionCount" >
< value > ${proxool.minimumConnectionCount} </ value >
</ property >
< property name = "trace" >
< value > ${proxool.trace} </ value >
</ property >
< property name = "verbose" >
< value > ${proxool.verbose} </ value >
</ property >
</ bean >
1、 不推荐用 使用官方的 jdbc 驱动 SQLServerDriver, 因为与连接池 proxool 一起使用出现了错误。
2、 加入 jtds.jar 包
复制 jtds.jar 到 WEB-INF/lib 目录下,用到的驱动是 net.sourceforge.jtds.jdbc.Driver
3、 配置 proxool.properties
配置后,放置在 WEB-INF 目录下,对应 < value > /WEB-INF/proxool.properties </ value > 这个地方
内容如下:
proxool.database= share
proxool.alias= proxool_vange
#proxool 的一个 Bug, 要直接写到连接符里面
proxool.username= Vange
proxool.password= vangelee
proxool.driver= net.sourceforge.jtds.jdbc.Driver
proxool.url= jdbc : jtds:sqlserver://127.0.0.1:1433/${proxool.database};user=${proxool.username};password=${proxool.password}
proxool.houseKeepingSleepTime= 40000
proxool.house-keeping-test-sql= select CURRENT_DATE
proxool.maximumConnectionCount= 10
proxool.minimumConnectionCount= 3
proxool.maximum-connection-lifetime= 18000000
proxool.simultaneous-build-throttle= 5
proxool.recently-started-threshold= 40000
proxool.overload-without-refusal-lifetime= 50000
proxool.maximum-active-time= 60000
proxool.verbose= true
proxool.trace= true
proxool.fatal-sql-exception= Fatalerror
proxool.prototypeCount= 2
4、 加入属性自动读取
< bean id = "propertyConfigurer" class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
lazy-init = "false" >
< property name = "locations" >
< list >
< value > /WEB-INF/proxool.properties </ value >
</ list >
</ property >
</ bean >