Tomcat数据连接池的问题 ,操作一段时间后频繁报错(denies access to data source )!

Jeroki 2004-03-17 11:08:13
大家帮我看看这些连接池,该怎样改进才能避免出错啊!


平台环境:Tomcat(4。1)+MySQL(4.0.12)+winxp Home Edition
出错提示:
Tomcat服务器提示
Server configuration denies access to data source

一下是连接池的代码:
////////////////////////////////////////////////////////////////////////
package com.es.bbs;

import com.es.util.PropertyManager;
import java.io.PrintStream;
import java.sql.*;

public class BbsReg
{

public BbsReg()
{
sDBDriver = PropertyManager.getProperty("DbConnectionDefaultPool.dbDriver");
sConnStr = PropertyManager.getProperty("DbConnectionDefaultPool.dbUrl");
user = PropertyManager.getProperty("DbConnectionDefaultPool.dbUser");
password = PropertyManager.getProperty("DbConnectionDefaultPool.dbPassword");
conn = null;
rs = null;
try
{
Class.forName(sDBDriver);
}
catch(ClassNotFoundException e)
{
System.err.println("BbsReg(): " + e.getMessage());
}
}

public ResultSet executeQuery(String sql)
{
rs = null;
try
{
conn = DriverManager.getConnection(sConnStr, user, password);
Statement stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
}
catch(SQLException ex)
{
System.err.println("aq.executeQuery: " + ex.getMessage());
System.err.println("aq.executeQuerystrSQL: " + sql);
}
return rs;
}

public void executeUpdate(String sql)
{
try
{
conn = DriverManager.getConnection(sConnStr, user, password);
Statement stmt = conn.createStatement();
stmt.executeUpdate(sql);
}
catch(SQLException ex)
{
System.err.println("aq.executeUpdate: " + ex.getMessage());
System.err.println("aq.executeUpadatestrSQL: " + sql);
}
}

String sDBDriver;
String sConnStr;
String user;
String password;
Connection conn;
ResultSet rs;
}
//////////////////////////////////////////////
/////////调用连接池///////////////////
package com.es.bbs;

import java.io.PrintStream;
import java.sql.ResultSet;
import java.sql.SQLException;


public class BbsAdmin
{

public BbsAdmin()
{
dbconn = new BbsReg();
rs = null;
id = 0;
adminname = "";
adminpwd = "";
}

public boolean checkAdminPassword(String s, String s1)
{
rs = null;
strSQL = "select * from slt_bbs_admin where adminname='" + s + "' and adminpwd='" + s1 + "'";
try
{
rs = dbconn.executeQuery(strSQL);
if(rs != null && rs.next())
{
yesorno = true;
adminname = rs.getString("adminname");
adminpwd = rs.getString("adminpwd");
} else
{
yesorno = false;
}
if(rs != null)
rs.close();
}
catch(SQLException sqlexception)
{
System.err.println("aq.executeQuery: " + sqlexception.getMessage());
System.err.println("checkuserpassword.STRSQL:: " + strSQL);
}
return yesorno;
}

public String getAdminName()
{
return adminname;
}

public String getAdminPassword()
{
return adminpwd;
}

BbsReg dbconn;
ResultSet rs;
String strSQL;
boolean yesorno;
int id;
String adminname;
String adminpwd;
}
...全文
75 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
lhbf 2004-03-17
  • 打赏
  • 举报
回复
推荐使用成熟的连接池如:poolman2.0.4
另:楼上的Leemaasn(呆鸟一号)回答问题怎么经常显示的字不全。
Leemaasn 2004-03-17
  • 打赏
  • 举报
回复
應該是你的Mysql數據庫裏沒有為root@localhost開通權限
你到MySQL數據庫裏的表user裏,按照格式添加一條記錄就可以了。
icool8 2004-03-17
  • 打赏
  • 举报
回复
你的不是连接池吧!

在你所谓的连接池类里加个方法,close
当数据库连接不用时,将数据库连接关掉!
Jeroki 2004-03-17
  • 打赏
  • 举报
回复
DbPool.Properties


DbConnectionDefaultPool.charset=iso8859-1
DbConnectionDefaultPool.dbType=mysql
DbConnectionDefaultPool.dbDriver=com.mysql.jdbc.Driver
DbConnectionDefaultPool.dbUrl=jdbc:mysql://localhost/eworks20
DbConnectionDefaultPool.dbUser=root
DbConnectionDefaultPool.dbPassword=
DbConnectionDefaultPool.minConnections=3
DbConnectionDefaultPool.maxConnections=5
woliuliudada 2004-03-17
  • 打赏
  • 举报
回复
没关连接池.连接池满了就连不上了.
要养成好习惯,用完就关
As different wireless technologies are launched to enable user mobility and provide pervasive network and service accessibility, security has been a prominent requirement for the U.S. Federal Government in such access environments. Access authentication and the establishment of keys that protect wireless traffic are both core security components in wireless applications. The Extensible Authentication Protocol (EAP), specified in IETF RFC 3748 [18], is a framework for access authentication, which supports different authentication methods that are specified as EAP methods. Numerous EAP methods have been published as IETF RFCs and implemented by various vendors. Currently, EAP has been adopted by various wireless standards as an access authentication and key establishment protocol. As described in RFC 4017[19], it is desirable for EAP methods used for wireless LAN to support mutual authentication and key derivation. Informally, in an EAP execution for wireless access, there are usually three players, a wireless station such as a laptop computer (called a “peer” in EAP), a wireless point of attachment (PoA) (may be collocated with an “authenticator” in EAP) and a backend EAP server, which determines whether the access authentication of a peer succeeds or fails using EAP. Based on the authentication results, the PoA authorizes or denies the wireless access of the peer. For example, IEEE 802.11 [14] for Wireless Local Area Networks (WLANs) uses IEEE 802.1X [15] as a way to encapsulate EAP messages over LAN (EAPOL) for providing access authentication and key establishment. Even though EAP is also used as an authentication framework for wired access, this Recommendation will focus on requirements for wireless access authentication and key establishment. EAP was originally designed and used to support user password authentication to Internet service providers for dial-up services using the Point to Point Protocol (PPP). At that time, the point-to-point nature of the connection-oriented wireline phone network and the consequently relatively limited, applicable attack models did not demand extensive security provisions for the use of EAP. As a result, the EAP methods defined in [18] support neither mutual authentication nor key derivation. Today dial-up Internet service is comparatively rare, but shared media Ethernets, as well as wireless networks supporting various degrees of mobility, are quite common, while authentication of both users and machines is increasingly considered a basic prerequisite for network access. In such environments and with much more sophisticated modern Internet attack models, naive implementations of early EAP methods as defined in [18] are insecure. In addition to these older and less secure methods, there are now a number of stronger EAP methods intended for integrated use with standard wireless access protocols, such that the keys generated in an EAP execution are used to protect against wireless eavesdroppers and more sophisticated active man-in-the middle attacks. Many EAP methods define a set of supported cryptographic schemes and algorithms—for example, for authentication, key establishment, and/or message protection—called a ciphersuite. Other EAP methods do not offer such a choice, and only support one cryptographic algorithm for each security functionality. The diversity of EAP methods enables the implementation and use of a variety of authentication and key establishment methods to protect wireless network access. Security assessments of each EAP method with a specific set of cryptographic algorithms and schemes are crucial for securely launching wireless applications. These assessments must be based on a well-defined set of common security requirements for EAP methods used for wireless access authentication and key establishment for link protection.

81,115

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧