Proxool connection pool usage experience

Source: Internet
Author: User

Official site: http://proxool.sourceforge.net/current version: proxool-0.9.0RC2
1. Download proxool address: http://proxool.sourceforge.net
2XX uncompress proxool-0.9.0rc2.zip, copy lib/proxool-0.9.0RC2.jar to Web-info/lib copy JDBC driver to Web-info/lib
3. Create a file under Web-Info: proxool. xml
<? XML version = "1.0" encoding = "UTF-8"?>
<Something-else-entirely>
<Proxool>
<Alias> test </alias>
<Driver-URL> JDBC: oracle: thin: @ 192.168.10.160: 1521: orc1 </driver-URL>
<Driver-class> oracle. JDBC. Driver. oracledriver </driver-class>
<Driver-Properties>
<Property name = "user" value = "test"/>
<Property name = "password" value = "testpass"/>
</Driver-Properties>
<Maximum-connection-count> 10 </maximum-connection-count>
<House-keeping-test-SQL> select current_date </Proxool>
</Something-else-entirely>
4. Add the following in Web. xml:
<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/config/proxool. xml </param-value>
</Init-param>
<Load-on-startup> 1 </load-on-startup>
</Servlet>
<! -- The management and monitoring tool provided by proxool to view the current database connection status. If the operation fails, delete the row -->
<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>
5. Call the database connection Code :
Class. forname ("org. logicalcobwebs. proxool. proxooldriver ");
Connection conn = drivermanager. getconnection ("proxool. Develop ");

6. Use the proxool monitoring tool to view the database running status. Address:./admin
The preceding configuration adopts the XML file mode, or the properties configuration mode:
Proxool. Alias = test
Proxool. Driver-class = oracle. JDBC. Driver. oracledriver
Proxool. Driver-url = JDBC: oracle: thin: @ 192.168.10.160: 1521: orcl
Proxool. User = test
Proxool. Password = testpass
Proxool. Maximum-connection-Count = 20
Proxool. Prototype-Count = 4
Proxool. House-keeping-test-SQL = select sysdate from dual
Proxool. verbose = true
Proxool. Statistics = 10 s, 1 m, 1D
Proxool. Statistics-log-level = Error
<Servlet>
<Servlet-Name> servletconfigurator </servlet-Name>
<Servlet-class> org. logicalcobwebs. proxool. configuration. servletconfigurator </servlet-class>
<Init-param>
<Param-Name> propertyfile </param-Name>
<Param-value> WEB-INF/config/proxool. properties </param-value>
</Init-param>
<Load-on-startup> 1 </load-on-startup>
</Servlet>
When calling the database connection code
Class. forname ("org. logicalcobwebs. proxool. proxooldriver ");
Connection conn = drivermanager. getconnection ("proxool. test ");
There are also some configuration attributes:
Maximum-connection-lifetime maximum connection Life Cycle default value: 4 hours
Maximum-active-time: Maximum activity time default value: 5 minutes
Maximum-connection-count maximum number of connections default value: 15
Minimum-connection-count minimum connections default value: 5
When using admin, you can view the status of all connections of the Web application. Although the plug-in can automatically put inactive connections in the connection pool, if there are too many connections, if you do not kill the website in time, the connection to the website will be greatly affected. We recommend that you manually kill the website.
Note: The connection should be closed normally when the connection is used. For operations that take a long time, the value of maximum-active-time must be greater. Otherwise, the connection pool will close when the time is reached, database Operation error. For continuous statistical tasks, database connections can take longer than one hour. You should consider automatic shutdown, add transaction processing, and re-establish the connection.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.