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系统JSP+JDBC
共91个文件
gif:46个
jsp:28个
ini:7个
需积分: 9 11 下载量 95 浏览量
2010-06-24
20:25:57
上传
评论
收藏 106KB RAR 举报
温馨提示
用JSP和数据库结合编写的BBS系统。该系统提供一个用户发帖回帖的交流平台,管理员管理分类、帖子和用户的管理平台。
资源推荐
资源详情
资源评论
收起资源包目录
BBS系统.rar (91个子文件)
第6章
_desktop.ini 10B
bbs
images
icon_12.gif 253B
1.gif 478B
icon_37.gif 334B
button.gif 184B
mreply.gif 2KB
u=1725436035,1126197281gp=1.jpg 1KB
2.gif 553B
06.gif 748B
part1_38.gif 522B
btn_18.gif 722B
_desktop.ini 10B
part1_44.gif 50B
btn_28.gif 1KB
icon_04.gif 475B
bg_c1.gif 844B
icon_8.gif 225B
4.gif 234B
download.gif 1KB
header_21.gif 150B
btn_30.gif 1KB
part1_51.gif 188B
part1_41.gif 254B
btn_32.gif 1KB
part1_52.gif 93B
icon_36.gif 470B
3.gif 217B
btn_24.gif 642B
icon_5.gif 264B
FEN.GIF 355B
part1_48.gif 64B
part1_55.gif 209B
postnew.gif 2KB
Thumbs.db 60KB
bg_02.gif 73B
admin_bg_1.gif 75B
part1_37.gif 237B
action.jsp 2KB
reg.jsp 5KB
admin
del_sort.jsp 834B
edit_sort.jsp 4KB
del_user.jsp 859B
topic_manage.jsp 4KB
_desktop.ini 10B
login_check.jsp 942B
add_sort.jsp 3KB
login.jsp 3KB
del_topic.jsp 827B
edit_topic.jsp 4KB
image
de2.gif 195B
menu_bottom2.gif 3KB
txtLine.gif 55B
_desktop.ini 10B
menu_body.gif 198B
u=1725436035,1126197281&gp=1.jpg 2KB
ATS.jpg 2KB
admin_bg.gif 1006B
menu_top.gif 941B
middle_bg.gif 146B
add.gif 253B
de1.gif 818B
right_home.gif 1KB
ico1.gif 53B
middle_buttom_bg.gif 384B
Thumbs.db 20KB
admin_bg_1.gif 75B
user_manage.jsp 4KB
addsort_check.jsp 1KB
left.jsp 2KB
edittopic_check.jsp 1KB
sort_manage.jsp 5KB
main.jsp 358B
editsort_check.jsp 1KB
topic.jsp 8KB
_desktop.ini 10B
new_topic.jsp 4KB
new_check.jsp 2KB
login_action.jsp 358B
login.jsp 2KB
error.jsp 2KB
sort.jsp 6KB
reg_check.jsp 3KB
main.jsp 661B
topic_detail.jsp 4KB
WEB-INF
classes
ConnPool.class 2KB
ConnPool.java 2KB
_desktop.ini 10B
ConnManager.java 2KB
ConnManager.class 3KB
_desktop.ini 10B
web.xml 694B
共 91 条
- 1
资源评论
mengxi1413
- 粉丝: 0
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功