DBCP配置方法(Oracle下)
1.修改Tomcat的context.xml,加入以下配置
name="jdbc/oracle"
auth="Container"
type="javax.sql.DataSource"
maxActive="1000"
maxIdle="30"
maxWait="10000"
username="tech"
password="pwd"
driverClassName="oracle.jdbc.driver.OracleDriver"
validationQuery = "select 1 from dual "
testOnBorrow = "true"
testOnReturn = "false"
testWhileIdle = "true"
timeBetweenEvictionRunsMillis = "15000"
numTestsPerEvictionRun = "10"
minEvictableIdleTimeMillis = "600000"
url="jdbc:oracle:thin:@localhost:1521:ORA921"
/>
2.修改spring配置文件,加入以下配置:
class="org.springframework.jndi.JndiObjectFactoryBean">
java:comp/env/jdbc/oracle
DPCP详细配置:http://commons.apache.org/dbcp/configuration.html