日期:2014-05-16 浏览次数:20561 次
<?xml version="1.0" encoding="UTF-8"?> <something-else-entirely> <proxool> <!-- 给此数据库连接取一个别名 --> <alias>proxoolPool</alias> <!-- 数据库连接url,不同数据库url不一样 --> <driver-url>jdbc:mysql://localhost:3306/zzoj</driver-url> <!-- 加载的数据库驱动类 --> <driver-class>com.mysql.jdbc.Driver</driver-class> <!-- 设定数据库连接的用户名和密码 --> <driver-properties> <property name="user" value="root"/> <property name="password" value=""/> </driver-properties> <house-keeping-test-sql>select CURRENT_DATE from DUAL</house-keeping-test-sql> <!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁--> <house-keeping-sleep-time>90000</house-keeping-sleep-time> <!-- 最少保持的空闲连接数--> <prototype-count>5</prototype-count> <!-- 允许最大连接数,超过了这个连接,再有请求时,就排在队列中等候,最大的等待请求数由maximum-new-connections决定--> <maximum-connection-count>100</maximum-connection-count> <!-- 最小连接数--> <minimum-connection-count>10</minimum-connection-count> </proxool> </something-else-entirely>
<servlet> <servlet-name>proxoolServletConfigurator</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>
<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>
Class.forName("org.logicalcobwebs.proxool.ProxoolDriver"); Connection conn = DriverManager.getConnection("proxool.proxoolPool");