package bbs;
import java.sql.*;
import java.util.*;
public class ConnManager {
private Vector PoolNames = new Vector();
private Vector DriverNames = new Vector();
private Vector DbIds = new Vector();
private Vector UserNames = new Vector();
private Vector Passwords = new Vector();
private Vector MaxConns = new Vector();
private Hashtable ConnPools = new Hashtable();
public ConnManager() {
PoolNames.addElement("bbs");
DriverNames.addElement("org.gjt.mm.mysql.Driver");
DbIds.addElement("jdbc:mysql://localhost:3306/bbs");
UserNames.addElement("root");
Passwords.addElement("123");
MaxConns.addElement("10");
createPool();
}
private void createPool() {
for(int i = 0; i<PoolNames.size();i++){
String PoolName = PoolNames.elementAt(i).toString();
String DriverName = DriverNames.elementAt(i).toString();
String DbId = DbIds.elementAt(i).toString();
String UserName = UserNames.elementAt(i).toString();
String Password = Passwords.elementAt(i).toString();
int Maxconn=0;
try {
Maxconn = Integer.parseInt(MaxConns.elementAt(i).toString());
}
catch (NumberFormatException e) {
e.printStackTrace();
}
ConnPool Pool = new ConnPool(PoolName, DriverName, DbId,UseName, Password, Maxconn);
ConnPools.put(PoolName, Pool);
}
}
public Connection getConnection(String name) {
ConnPool Pool = (ConnPool) ConnPools.get(name);
if (Pool != null)
return Pool.getConnection();
return null;
}
public void releaseConnection(String name, Connection con) {
ConnPool pool = (ConnPool) ConnPools.get(name);
if (pool != null)
pool.releaseConnection(con);
}
public synchronized void destroyPool () {
Enumeration allPools = ConnPools.elements();
while (allPools.hasMoreElements()) {
ConnPool Pool = (ConnPool) allPools.nextElement();
Pool.destroyPool ();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
BBS电子公告板 计算机网络课程设计
共90个文件
gif:46个
jsp:28个
ini:6个
4星 · 超过85%的资源 需积分: 9 37 下载量 199 浏览量
2009-07-09
20:05:28
上传
评论
收藏 108KB ZIP 举报
温馨提示
计算机网络课程设计,JSP组做的电子公告板,环境设置正确后 ,可以很好的运行
资源推荐
资源详情
资源评论
收起资源包目录
bbs.zip (90个子文件)
bbs
admin
addsort_check.jsp 1KB
edit_sort.jsp 4KB
_desktop.ini 10B
image
middle_bg.gif 146B
add.gif 253B
_desktop.ini 10B
menu_bottom2.gif 3KB
de1.gif 818B
u=1725436035,1126197281&gp=1.jpg 2KB
txtLine.gif 55B
menu_body.gif 198B
admin_bg.gif 1006B
middle_buttom_bg.gif 384B
Thumbs.db 20KB
admin_bg_1.gif 75B
right_home.gif 1KB
ico1.gif 53B
de2.gif 195B
menu_top.gif 941B
ATS.jpg 2KB
del_sort.jsp 834B
user_manage.jsp 4KB
main.jsp 358B
edit_topic.jsp 4KB
del_user.jsp 859B
del_topic.jsp 827B
topic_manage.jsp 4KB
login.jsp 3KB
add_sort.jsp 3KB
sort_manage.jsp 5KB
editsort_check.jsp 1KB
login_check.jsp 942B
left.jsp 2KB
edittopic_check.jsp 1KB
images
bg_c1.gif 844B
part1_51.gif 188B
part1_41.gif 254B
btn_18.gif 722B
06.gif 748B
icon_36.gif 470B
u=1725436035,1126197281gp=1.jpg 1KB
_desktop.ini 10B
2.gif 553B
1.gif 478B
part1_55.gif 209B
btn_28.gif 1KB
3.gif 217B
download.gif 1KB
FEN.GIF 355B
header_21.gif 150B
icon_04.gif 475B
bg_02.gif 73B
btn_32.gif 1KB
part1_38.gif 522B
4.gif 234B
btn_30.gif 1KB
button.gif 184B
postnew.gif 2KB
btn_24.gif 642B
part1_44.gif 50B
mreply.gif 2KB
Thumbs.db 60KB
icon_5.gif 264B
admin_bg_1.gif 75B
icon_37.gif 334B
part1_52.gif 93B
icon_12.gif 253B
icon_8.gif 225B
part1_37.gif 237B
part1_48.gif 64B
sort.jsp 6KB
_desktop.ini 10B
login_action.jsp 358B
WEB-INF
_desktop.ini 10B
web.xml 694B
classes
_desktop.ini 10B
ConnManager.java 2KB
ConnManager.class 3KB
ConnPool.java 2KB
ConnPool.class 2KB
reg_check.jsp 3KB
main.jsp 661B
reg.jsp 5KB
new_check.jsp 2KB
login.jsp 2KB
action.jsp 2KB
error.jsp 2KB
topic_detail.jsp 4KB
topic.jsp 8KB
new_topic.jsp 4KB
共 90 条
- 1
资源评论
- knightzg2012-06-28这个软件还行。用着很看好
nemo863863
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功