コード例 #1
0
  public String[] callplBtnprocess(
      String processId, String programId, String username, int org, String preD, String sentD) {

    String[] results = null;
    Connection dbConnection = null;
    CallableStatement callableStatement = null;
    _log.info("##into PL");

    String MR_SP_ZZZZ_RESTORE_PROCESS_Sql = "{call MR_STP_PREPARE_AND_SEND_DATA(?,?,?,?,?,?,?,?)}";
    try {
      dbConnection = DBManager.getNoJtaDataSource();
      callableStatement = dbConnection.prepareCall(MR_SP_ZZZZ_RESTORE_PROCESS_Sql);
      /*
              p_status        OUT  VARCHAR2,
              p_result        OUT  VARCHAR2,
              p_user_name     IN   VARCHAR2,
              p_org_id        IN   NUMBER,
              p_process_id    IN   VARCHAR2,
              p_program_id    IN   VARCHAR2,
              p_prepare_data  IN   VARCHAR2,  7
              p_send_data     IN   VARCHAR2   8
      */
      callableStatement.registerOutParameter(1, java.sql.Types.VARCHAR);
      callableStatement.registerOutParameter(2, java.sql.Types.VARCHAR);
      callableStatement.setString(3, username);
      callableStatement.setInt(4, 1);
      callableStatement.setString(5, processId);
      callableStatement.setString(6, programId);

      callableStatement.setString(7, preD);
      callableStatement.setString(8, sentD);
      callableStatement.executeUpdate();
      String status = callableStatement.getString(1);
      String result = callableStatement.getString(2);
      results = new String[] {status, result};
      _log.info("status 2: " + status);
      _log.info("result 2: " + result);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (callableStatement != null) {
        try {
          callableStatement.close();
        } catch (SQLException e) {
          e.printStackTrace();
        }
      }
      if (dbConnection != null) {
        try {
          dbConnection.close();
        } catch (SQLException e) {
          e.printStackTrace();
        }
      }
    }
    return results;
  }
コード例 #2
0
  public PrepareAndSend callpldowloadfileconfig(
      int organizId, String processId, String programId, String username, String nameDownLoad) {

    String[] results = null;
    Connection dbConnection = null;
    CallableStatement callableStatement = null;
    _log.info("##into PL");
    ResultSet rs = null;
    PrepareAndSend item = null;
    String MR_SP_ZZZZ_RESTORE_PROCESS_Sql =
        "{call MR_PKG_FILE_MANAGEMENT.MR_STP_GET_INF_FILE_CONFIG(?,?,?,?,?,?,?,?)}";
    try {
      dbConnection = DBManager.getNoJtaDataSource();
      callableStatement = dbConnection.prepareCall(MR_SP_ZZZZ_RESTORE_PROCESS_Sql);
      /*
            PROCEDURE MR_STP_GET_INF_FILE_CONFIG(p_status        OUT  VARCHAR2,
                                                 p_result        OUT  VARCHAR2,
                                                 p_file_config   OUT  SYS_REFCURSOR,
                                                 p_user_name     IN   VARCHAR2,
                                                 p_org_id        IN   NUMBER,
                                                 p_process_id    IN   VARCHAR2,
                                                 p_program_id    IN   VARCHAR2,
                                                 p_data_name     IN   VARCHAR2);

      */
      callableStatement.registerOutParameter(1, java.sql.Types.VARCHAR);
      callableStatement.registerOutParameter(2, java.sql.Types.VARCHAR);
      callableStatement.registerOutParameter(3, OracleTypes.CURSOR); // REF CURSOR
      callableStatement.setString(4, username);
      callableStatement.setInt(5, organizId);
      callableStatement.setString(6, processId);
      callableStatement.setString(7, programId);
      callableStatement.setString(8, nameDownLoad);
      callableStatement.executeUpdate();
      String status = callableStatement.getString(1);
      String result = callableStatement.getString(2);
      _log.info("status 1: " + status);
      _log.info("result 2: " + result);
      results = new String[] {status, result};
      rs = (ResultSet) callableStatement.getObject(3);

      while (rs.next()) {
        item = new PrepareAndSend();
        item.setFileNamePrefix(rs.getString("FILE_NAME_PREFIX"));
        item.setFileNameSuffix(rs.getString("FILE_NAME_SUFFIX"));
        item.setTargetFilePath(rs.getString("TARGET_FILE_PATH"));
      }
      item.setStatus(status);
      item.setResult(result);

    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (rs != null) {
        try {
          rs.close();
        } catch (SQLException e) {
          e.printStackTrace();
        }
      }

      if (callableStatement != null) {
        try {
          callableStatement.close();
        } catch (SQLException e) {
          e.printStackTrace();
        }
      }
      if (dbConnection != null) {
        try {
          dbConnection.close();
        } catch (SQLException e) {
          e.printStackTrace();
        }
      }
    }
    return item;
  }