连接池配置
<?xml version="1.0" encoding="UTF-8"?>
<proxool-config>
<proxool>
<alias>Pool_es</alias>
<!--
<driver-url>jdbc:oracle:thin:@1521:orcl</driver-url>
<driver-url>jdbc:oracle:thin:@1521:orcl</driver-url>
<driver-url>jdbc:oracle:thin:@1521:db</driver-url>
<driver-url>jdbc:oracle:thin:@1521:orcl</driver-url>
<driver-url>jdbc:oracle:thin:@1521:orcl</driver-url>
-->
<driver-url>jdbc:oracle:thin:@1521:db</driver-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<!--
<property name="user" value="" />
<property name="user" value="" />
-->
<property name="user" value="" />
<property name="password" value="" />
</driver-properties>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
<maximum-connection-count>600</maximum-connection-count>
<minimum-connection-count>10</minimum-connection-count>
<maximum-active-time>172800000</maximum-active-time>
<maximum-connection-lifetime>180000000</maximum-connection-lifetime>
<prototype-count>2</prototype-count>
<simultaneous-build-throttle>50</simultaneous-build-throttle>
<house-keeping-test-sql>select CURRENT_DATE from dual
</house-keeping-test-sql>
<statistics>15s,10m,1d</statistics>
<statistics-log-level>ERROR</statistics-log-level>
</proxool>
<!-- 数据源 -->
<proxool>
<alias>Pool_pre</alias>
<driver-url>jdbc:oracle:thin:@1521db</driver-url>
<!-- <driver-url>jdbc:oracle:thin:@1521:orcl</driver-url> -->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<property name="user" value="" />
<property name="password" value="" />
</driver-properties>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
<maximum-connection-count>600</maximum-connection-count>
<minimum-connection-count>10</minimum-connection-count>
<maximum-active-time>172800000</maximum-active-time>
<maximum-connection-lifetime>180000000</maximum-connection-lifetime>
<prototype-count>2</prototype-count>
<simultaneous-build-throttle>50</simultaneous-build-throttle>
<house-keeping-test-sql>select CURRENT_DATE from dual
</house-keeping-test-sql>
<statistics>15s,10m,1d</statistics>
<statistics-log-level>ERROR</statistics-log-level>
</proxool>
<proxool>
<alias>mysql_es</alias>
<driver-url>jdbc:mysql://3306/jcpdjh</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="" />
<property name="password" value="" />
</driver-properties>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
<maximum-connection-count>600</maximum-connection-count>
<minimum-connection-count>10</minimum-connection-count>
<maximum-active-time>172800000</maximum-active-time>
<maximum-connection-lifetime>180000000</maximum-connection-lifetime>
<prototype-count>2</prototype-count>
<simultaneous-build-throttle>50</simultaneous-build-throttle>
<statistics>15s,10m,1d</statistics>
<house-keeping-test-sql>select COUNT(1) from attendance_record
</house-keeping-test-sql>
<statistics-log-level>ERROR</statistics-log-level>
</proxool>
</proxool-config>
spring的配置文件
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.Pool_es</value>
</property>
</bean>
<!-- 第二个数据源配置 -->
<bean id="preDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.Pool_pre</value>
</property>
</bean>
<!-- 数据源配置, 使用pool连接池 -->
<bean id="mySqlataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.mysql_es</value>
</property>
</bean>
<bean name="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean name="preJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="preDataSource"/>
</bean>
<bean name="mySqlJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="mySqlataSource"/>
</bean>
Web.xml的配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:/applicationContext.xml,
classpath*:/applicationContext-webService.xml,
classpath*:/quartz/applicationContext-quartz.xml
</param-value>
</context-param>
<context-param>
<param-name>proxoolConfigLocation</param-name>
<param-value>WEB-INF/classes/proxool.xml</param-value>
</context-param>
<listener>
<listener-class>org.logicalcobwebs.proxool.configuration.ListenerConfigurator</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>openEntityManagerInViewFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openEntityManagerInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>com.gsww.es.filter.AuthenticationFilter</filter-class>
<!--排除的路径 -->
<init-param>
<param-name>excludedPages</param-name>
<param-value>/login.jsp,/authcode.jsp,/time_out.jsp,/resource,/login,/services,/accountAdminSave,/addAdmin,/departmenttree</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>startDestoryFilter</filter-name>
<filter-class>com.gsww.es.filter.StartDestoryTaskFilter</filter-class>
</filter>
<servlet>
<servlet-name>springServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Admin</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Admin</servlet-name>
<url-pattern>/admin</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/views/error/500.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/WEB-INF/views/error/500.jsp</location>
</error-page>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/views/error/404.jsp</location>
</error-page>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>