shisongsong 2017-01-17
Proxool或C3P0数据库连接池:
配置:
pom.xml
<dependency>
<groupId>proxool</groupId>
<artifactId>proxool</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>com.cloudhopper.proxool</groupId>
<artifactId>proxool-cglib</artifactId>
<version>0.9.1</version>
</dependency>
proxool.xml
<?xml version="1.0" encoding="UTF-8"?>
<proxool-config>
<proxool>
<alias>esteelDB</alias>
<driver-url>jdbc:oracle:thin:@10.0.1.177:1521:shdgdb</driver-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<property name="user" value="shdg"/>
<property name="password" value="shdg"/>
</driver-properties>
<house-keeping-sleep-time>90000</house-keeping-sleep-time>
<maximum-connection-count>10</maximum-connection-count>
<minimum-connection-count>2</minimum-connection-count>
<prototype-count>5</prototype-count>
<simultaneous-build-throttle>20</simultaneous-build-throttle>
<statistics>15s,10m,1d</statistics>
<statistics-log-level>INFO</statistics-log-level>
<house-keeping-test-sql>select 1</house-keeping-test-sql>
</proxool>
</proxool-config>
web.xml
<servlet>
<servlet-name>ServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>WEB-INF/proxool.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
application.xml
<!-- 数据库连接池配置 -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.logicalcobwebs.proxool.ProxoolDriver" />
<property name="url" value="proxool.esteelDB" />///自动检测配置文件按别名取
</bean>