Example usage for java.sql CallableStatement setString

List of usage examples for java.sql CallableStatement setString

Introduction

In this page you can find the example usage for java.sql CallableStatement setString.

Prototype

void setString(String parameterName, String x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given Java String value.

Usage

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ????/*w  w w  . ja  va  2s .  c o m*/
 * @param declNo
 */
public static void saveDeclInfoAbnormal(String declNo, int flg) {
    Connection conn = null;
    CallableStatement proc = null;
    String call = "{call Pro_SaveDeclInfoAbnormal(?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declNo);
        proc.setInt(2, flg);
        proc.execute();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N42", e);
    } catch (Exception e) {
        log.error("N43", e);
    } finally {
        try {
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N44", e);
        }
    }
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ?????//from   w ww . j  av a 2s . c  o  m
 * @param declNo
 */
public static void calculateAllDeclProductSampling(String declNo) {
    Connection conn = null;
    CallableStatement proc = null;
    String call = "{call Pro_CalculateAllDeclProductSampling(?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declNo);
        proc.execute();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N36", e);
    } catch (Exception e) {
        log.error("N37", e);
    } finally {
        try {
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N38", e);
        }
    }
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ????/*from w w w .  j a  v a  2s  . c o m*/
 * @param exchangeDto
 */
public static void saveDeclProductFromEnt(CEMSDeclExchangeDto exchangeDto) {
    Connection conn = null;
    CallableStatement proc = null;
    String call = "{call Pro_SaveDeclProductFromEnt(?,?,?,?,?,?,?,?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, exchangeDto.getSEQ_NUM());
        proc.setString(2, exchangeDto.getDECL_NO_TYPE());
        proc.setString(3, exchangeDto.getDECL_NO());
        proc.setString(4, exchangeDto.getRESULT_CONTENT());
        proc.setString(5, exchangeDto.getUPDATE_COUNT());
        proc.setString(6, exchangeDto.getLAST_OPER_DATE());
        proc.setString(7, exchangeDto.getGEN_FLAG());
        proc.setString(8, exchangeDto.getTRUE_DECL_NO());
        proc.setString(9, exchangeDto.getPROD_NO());
        proc.execute();
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N45", e);
    } catch (Exception e) {
        log.error("N46", e);
    } finally {
        try {
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N47", e);
        }
    }
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ?:?/*from w ww.j  a v  a 2 s .co  m*/
 * @return
 */
public static int checkRapidRelease(String declNo) {
    int retCode = -1;
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    String call = "{call Pro_CheckRapidRelease(?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declNo);
        proc.registerOutParameter(2, Types.INTEGER);
        proc.execute();
        retCode = proc.getInt(2);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N60", e);
    } catch (Exception e) {
        log.error("N61", e);
    } finally {
        try {
            if (rs != null) {
                rs.close();
            }
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N62", e);
        }
    }
    return retCode;
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ???/*from w  ww.j a v a  2 s  . co  m*/
 * @param declNo
 * @return
 */
public static String getDeclProductFromEnt(String declNo) {
    String declProductFromEnt = null;
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    String call = "{call Pro_GetDeclProductFromEnt(?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declNo);
        proc.execute();
        rs = proc.getResultSet();
        while (rs.next()) {
            declProductFromEnt = rs.getString("RESULT_CONTENT");
            break;
        }
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N51", e);
    } catch (Exception e) {
        log.error("N52", e);
    } finally {
        try {
            if (rs != null) {
                rs.close();
            }
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N53", e);
        }
    }
    return declProductFromEnt;
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ?????//from  w  w  w.  j  a v  a2 s.  c  o m
 * @param declNo
 * @return
 */
public static int checkDeclProductPerfect(String declNo) {
    int retCode = -1;
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    String call = "{call Pro_CheckDeclProductPerfect(?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declNo);
        proc.registerOutParameter(2, Types.INTEGER);
        proc.execute();
        retCode = proc.getInt(2);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error(e);
    } catch (Exception e) {
        log.error(e);
    } finally {
        try {
            if (rs != null) {
                rs.close();
            }
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error(e);
        }
    }
    return retCode;
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

public static int checkDeclProductSampling(String declNo) {
    int retCode = -1;
    Connection conn = null;/*w  w  w.  j ava2  s  .com*/
    CallableStatement proc = null;
    ResultSet rs = null;
    String call = "{call Pro_CheckDeclProductSampling(?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declNo);
        proc.registerOutParameter(2, Types.INTEGER);
        proc.execute();
        retCode = proc.getInt(2);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N57", e);
    } catch (Exception e) {
        log.error("N58", e);
    } finally {
        try {
            if (rs != null) {
                rs.close();
            }
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N59", e);
        }
    }
    return retCode;
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ???????/* ww  w. j  a  va2s. c  o  m*/
 */
public static int saveDeclProduct(String declNo, String entProductCode, String baseCode, String goodsNo) {
    int retCode = -1;
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    String call = "{call Pro_SaveDeclProduct(?,?,?,?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declNo);
        proc.setString(2, entProductCode);
        proc.setString(3, baseCode);
        proc.setString(4, goodsNo);
        proc.registerOutParameter(5, Types.INTEGER);
        proc.execute();
        retCode = proc.getInt(5);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N54", e);
    } catch (Exception e) {
        log.error("N55", e);
    } finally {
        try {
            if (rs != null) {
                rs.close();
            }
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N56", e);
        }
    }
    return retCode;
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ??//from   w ww .jav  a  2s  .  c om
 */
public static int checkEntExists(String entCode) {
    int retCode = -1;
    Connection conn = null;
    CallableStatement proc = null;
    String call = "{call Pro_CheckEntExists(?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        System.out.println("entcode" + entCode);
        proc.setString(1, entCode);
        proc.registerOutParameter(2, Types.INTEGER);
        proc.execute();
        retCode = proc.getInt(2);
        System.out.println("retcode" + retCode);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N39", e);
    } catch (Exception e) {
        log.error("N40", e);
    } finally {
        try {
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N41", e);
        }
    }
    return retCode;
}

From source file:cn.gov.scciq.timer.acceptOrder.FRMDao.java

/**
 * ?CIQ?//from w  w  w  .  j a  v a 2  s . c  o m
 * @return
 */
public static int saveCIQGoodsInfo(CEMSGoodsDataDto goodsDto) {
    int retCode = -1;
    Connection conn = null;
    CallableStatement proc = null;
    String call = "{call Pro_SaveCIQGoodsInfo(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, goodsDto.getDecl_No());
        proc.setString(2, goodsDto.getGoods_No());
        proc.setString(3, goodsDto.getHS_Code());
        proc.setString(4, goodsDto.getGoods_CName());
        proc.setString(5, goodsDto.getGoods_EName());
        proc.setString(6, goodsDto.getGoods_Model());
        proc.setString(7, goodsDto.getOrigin_Place_Code());
        proc.setString(8, goodsDto.getOrigin_Country_Code());
        proc.setString(9, goodsDto.getWeight());
        proc.setString(10, goodsDto.getWeight_Unit_Code());
        proc.setString(11, goodsDto.getSTD_Weight());
        proc.setString(12, goodsDto.getSTD_Weight_Unit_Code());
        proc.setString(13, goodsDto.getQTY());
        proc.setString(14, goodsDto.getQTY_Unit_Code());
        proc.setString(15, goodsDto.getSTD_QTY());
        proc.setString(16, goodsDto.getSTD_QTY_Unit_Code());
        proc.setString(17, goodsDto.getPack_Number());
        proc.setString(18, goodsDto.getPack_Type_Code());
        proc.setString(19, goodsDto.getCCY());
        proc.setString(20, goodsDto.getRate());
        proc.setString(21, goodsDto.getPrice());
        proc.setString(22, goodsDto.getGoods_Values());
        proc.setString(23, goodsDto.getValues_USD());
        proc.setString(24, goodsDto.getValues_RMB());
        proc.setString(25, goodsDto.getCIQ_CODE());
        proc.setString(26, goodsDto.getINSP_MODE_CODE());
        proc.setString(27, goodsDto.getCONDITION_FLAG());
        proc.setString(28, goodsDto.getWASTE_FLAG());
        proc.setString(29, goodsDto.getCHECKUP_TYPE_CODE());
        proc.setString(30, goodsDto.getCHECKUP_WORK_CODE());
        proc.setString(31, goodsDto.getSITUATION_CODE());
        proc.setString(32, goodsDto.getSITUATION_LEVEL());
        proc.setString(33, goodsDto.getPURPOSE_CODE());
        proc.setString(34, goodsDto.getNOTIFY_NOS());
        proc.setString(35, goodsDto.getPROD_NO());
        proc.setString(36, goodsDto.getCOMBBATCH_NO());
        proc.registerOutParameter(37, Types.INTEGER);
        proc.execute();
        retCode = proc.getInt(37);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("N30", e);
    } catch (Exception e) {
        log.error("N31", e);
    } finally {
        try {
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("N32", e);
        }
    }
    return retCode;
}