Examples of DbCon


Examples of kr.pe.okjsp.util.DbCon

    // file ���� ����

  }
  public int write(Article article) throws IOException {
    DbCon dbCon = new DbCon();
    Connection conn = null;
    int result = 0;
    try {
      conn = dbCon.getConnection();
     
      if ("recruit".equals(article.getBbs())) {
        checkSpam(conn, "recruit", String.valueOf(article.getSid()));
      }
     
      if (CommonUtil.nchk(article.getSubject()).trim().equals("")) {
        throw new IOException("No Subject");
      }
     
      conn.setAutoCommit(false);

      article.setSeq(getSeq(conn));
      article.setRef(getNewRef(conn, article.getBbs()));

      result = write(conn, article);
      conn.commit();
    } catch (SQLException e) {
      try {
        conn.rollback();
      } catch (SQLException e1) {
        System.out.println(e1);
      }
      System.out.println("write err: "+e);
    } catch (IOException e) {
      try {
        conn.rollback();
      } catch (SQLException e1) {
        System.out.println(e1);
      }
      throw e;
    } finally {
      try {
        conn.setAutoCommit(true);
      } catch (SQLException e) {
        System.out.println(e);
      }
      dbCon.close(conn, null);
    }

    return result;
  }
View Full Code Here

Examples of kr.pe.okjsp.util.DbCon

  }
 
  public int[] getAdList() {
    ArrayList<Integer> list = new ArrayList<Integer>();
    String sql = "select * from okboard_ad where startdate < sysdatetime and enddate > sysdatetime order by priority desc";
    DbCon dbCon = new DbCon();
    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      conn = dbCon.getConnection();
      pstmt = conn.prepareStatement(sql);

      rs = pstmt.executeQuery();
      while(rs.next()) {
        list.add(rs.getInt("seq"));
      }

    } catch (SQLException e) {
      System.out.println(e);
    } finally {
      dbCon.close(conn, pstmt, rs);
    }
   
    int[] ads = new int[list.size()];
    int i = 0;
    for(Integer seq : list) {
View Full Code Here

Examples of kr.pe.okjsp.util.DbCon

    }
   
    /*
      db �Է�
    */
    DbCon dbCon = new DbCon();
    Connection conn = null;
    ArticleDao articleDao = new ArticleDao();
   
    String act = multi.getParameter("act");
   
    try {

      conn = dbCon.getConnection();
      conn.setAutoCommit(false);

     
      String[] delFiles = null;

      int seq = 0;
      if ("MODIFY".equals(act)) {
        seq = Integer.parseInt(multi.getParameter("seq"));
        delFiles = multi.getParameterValues("delFile");
        article.setSeq(seq);
      }

      if ("REPLY".equals(act)) {
        article.setSeq(articleDao.getSeq(conn));
        article.setRef(Integer.parseInt(multi.getParameter("ref")));
        article.setLev(Integer.parseInt(multi.getParameter("lev")));
        article.setStep(
            Integer.parseInt(multi.getParameter("step")));
        articleDao.reply(conn, article);

      } else if ("MODIFY".equals(act)) {
        articleDao.modify(conn, article);
        articleDao.deleteFiles(conn, delFiles);
      } else {
        article.setSeq(articleDao.getSeq(conn));
        article.setRef(articleDao.getNewRef(conn, article.getBbs()));
        articleDao.write(article);
      }

      articleDao.addFile(conn, article.getSeq(), arrdf);
      conn.commit();
    } catch (Exception e) {
      System.out.println("WriteServlet err:" + CommonUtil.a2k(e.toString()));
    } finally {
      dbCon.close(conn, null);
    }
   
    setWriterCookie(DomainUtil.getBaseDomain(req.getRequestURL()), res, article);
   
    return article.getBbs();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.