Int("item_id");
c.add(new Integer(item_id));
c.addAll(getFamily(item_id));
}
return c;
} catch (SQLException sqlExc) {
sqlExc.printStackTrace();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
// 关闭连接,释放数据库资源:
try {
if (rs != null) {
rs.close();
}
if (stmt != null) {
stmt.close();
}
connPool.freeConnection(conn);
} catch (SQLException sqlExc) {
sqlExc.printStackTrace();
}
}
}
public Collection getFamilyLevel(int id, int level) {
// 创建数据库连接对象:
ConnectionPool connPool = DB.getConnPool();
Connection conn = connPool.getConnection();
Statement stmt = null;
ResultSet rs = null;
try {
// 创建数据记录集对象:
stmt = conn.createStatement();
// sql语句:
String sql = "select item_id from bbsitems where fathers_id='" + id
+ "' and item_id!='" + id + "'";
// System.out.println(sql);
// 执行sql语句,返回一个记录集到rs:
rs = stmt.executeQuery(sql);
Collection c = new ArrayList();
level++;
while (rs.next()) {
if (c == null)
上一篇:
BBSMsg.java
下一篇:
按摩连锁财务管理系统|按摩连锁财务管理系统第一版