快崩溃了,配置Proxool成功的高人来指点一下。

06-02-08 mwsssxu
Proxool.properties文件内容
jdbc-0.proxool.alias=proxool
jdbc-0.proxool.driver-class=com.microsoft.jdbc.sqlserver.SQLServerDriver
jdbc-0.proxool.driver-url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=NSWZCGXT
jdbc-0.user=sa
jdbc-0.password=

jdbc-0.proxool.maximum-connection-count=10
jdbc-0.proxool.prototype-count=2

jdbc-0.proxool.house-keeping-test-sql=select * from sysusers
jdbc-0.proxool.verbose=true

WEB.xml配置
<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/classes/Proxool.properties</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>

jsp文件

<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%>
<%String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>
My JSP 'Proxool.jsp' starting page
</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


<link href="style/styl.css" rel="stylesheet" type="text/css">

</head>

<body>
<br>
<%
out.println("连接中...");
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
con = DriverManager.getConnection("proxool.proxool");
stmt = con.createStatement();
String query = "select * from supply";
rs = stmt.executeQuery(query);
while (rs.next()) {
out.print(rs.getString("supname") + "--OK");
}

stmt.close();
con.close();
} catch (SQLException sqle) {
out.println("sqle.printStackTrace():");
sqle.printStackTrace();
//out.println("e.toString(): " + sqle.toString());
//out.println("sqle=" + sqle);
out.println("不能连接");
} finally {
try {
if (con != null) {
con.close();
}
} catch (SQLException sqle) {
//out.println("sqle=" + sqle);
out.println("不能连接");
}
}

%>
</body>
</html>

------------------------------
报错:Attempt to refer to a unregistered pool by its alias 'proxool'。等

各位大哥大姐,帮帮忙啊。

banq
2006-02-10 11:36
我晕,这种低级让人抓狂的连接池还去用它,连接池组件已经是Web容器的基础组件,直接使用即可,不同的连接池性能差别不大,你再花费力气研究操作系统级别的技术没有必要。

猜你喜欢