Properties file for use with mysql database connection pool proxool
Abstract: The paper attributes assigned to mysql database connection pool proxool
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle">
1, to write a document attributes: Proxool.properties, Add to your application's WEB WEB-INF \ classes below, as follows:
Jdbc-0.proxool.alias = mysql
Jdbc-0.proxool.driver-class = org.gjt.mm.mysql.Driver
Jdbc-0.proxool.driver-url = jdbc: mysql: / / localhost: 3306/soft? User = root & password =
<table Width="673" border="0"> <tr> <td width="387"> PropertyFile WEB-INF/classes/Proxool.properties
Jdbc-0.proxool.maximum-connection-count = 20
Jdbc-0.proxool.prototype-count = 4
Jdbc-0.proxool.house-keeping-test-sql = select CURRENT_DATE
Jdbc-0.proxool.verbose = true
Jdbc-0.proxool.statistics = 10s, 1m, 1d
Jdbc-0.proxool.statistics-log-level = DEBUG
2, so write web.xml:
<? Xml version = "1.0" encoding = "ISO-8859-1">
Web-app
PUBLIC "- / / Sun Microsystems, Inc / / DTD Web Application 2.3 / / EN"
"Http://java.sun.com/dtd/web-app_2_3.dtd">
</ Td> <td width="276"> </ td> </ tr> </ table>
3, will be the driving procedures mm.mysql-2.0.14-bin.jar and proxool-0.8.3.jar Add WEB-INF \ lib directory.
4, Below is the test jsp documents:
<% @ Page import = "java.sql .*"%>
<% @ Page contentType = "text / html; charset = GB2312"%>
<head>
</ Head>
<body>
Use Proxool Connection Pool
<%
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
Try (
Con = DriverManager.getConnection ( "proxool.mysql");
Stmt = con.createStatement ();
String query = "select * from count_num";
Rs = stmt.executeQuery (query);
While (rs.next ()) (
Out.print (rs.getLong (1 )+"– OK ");
)
Stmt.close ();
Con.close ();
) Catch (SQLException sqle) (
Out.println ( "sqle =" + sqle);
)
Finally (
Try (
If (con! = Null) (
Con.close ();
)
) Catch (SQLException sqle) (
Out.println ( "sqle =" + sqle);
)
)
%>
</ Body>
5, statistics and background information
Please go to: http://127.0.0.1:8080/testpxool/Admin
(Testpxool should read your application WEB) </ td> </ tr> <tr>
↑ Back
Tags: Connection, File, java mysql, java Properties, Properties






