Example usage for java.sql CallableStatement getInt

List of usage examples for java.sql CallableStatement getInt

Introduction

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

Prototype

int getInt(String parameterName) throws SQLException;

Source Link

Document

Retrieves the value of a JDBC INTEGER parameter as an int in the Java programming language.

Usage

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

/**
 * ?CIQ?/*from  w  ww . jav  a2s . c om*/
 * --?0??0
 */
public static int saveCIQDeclInfo(CEMSDeclDataDto declDto) {
    int retCode = -1;
    Connection conn = null;
    CallableStatement proc = null;
    String call = "{call Pro_SaveCIQDeclInfo(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
    try {
        conn = DBPool.ds.getConnection();
        proc = conn.prepareCall(call);
        proc.setString(1, declDto.getDecl_No());
        proc.setString(2, declDto.getDecl_Get_No());
        proc.setString(3, declDto.getDecl_Reg_No());
        proc.setString(4, declDto.getDecl_Person_Code());
        proc.setString(5, declDto.getDecl_Date());
        proc.setString(6, declDto.getEnt_Property());
        proc.setString(7, declDto.getConsignor_Code());
        proc.setString(8, declDto.getConsignor_CName());
        proc.setString(9, declDto.getConsignor_EName());
        proc.setString(10, declDto.getConsignee_Code());
        proc.setString(11, declDto.getConsignee_CName());
        proc.setString(12, declDto.getConsignee_EName());
        proc.setString(13, declDto.getTrans_Type_Code());
        proc.setString(14, declDto.getTrans_Means_Code());
        proc.setString(15, declDto.getTonnage());
        proc.setString(16, declDto.getTrade_Mode_Code());
        proc.setString(17, declDto.getGoods_Place_Code());
        proc.setString(18, declDto.getGoods_Place());
        proc.setString(19, declDto.getPurpose_Code());
        proc.setString(20, declDto.getDecl_Date());
        proc.setString(21, declDto.getArri_Date());
        proc.setString(22, declDto.getUnload_Date());
        proc.setString(23, declDto.getDesp_Port_Code());
        proc.setString(24, declDto.getArri_Port_Code());
        proc.setString(25, declDto.getEntry_Port_Code());
        proc.setString(26, declDto.getVia_Port_Code());
        proc.setString(27, declDto.getDest_Code());
        proc.setString(28, declDto.getTrade_Country_Code());
        proc.setString(29, declDto.getDesp_Country_Code());
        proc.setString(30, declDto.getSituation_Code());
        proc.setString(31, declDto.getSituation_Level());
        proc.setString(32, declDto.getCounter_Claim());
        proc.setString(33, declDto.getContract_No());
        proc.setString(34, declDto.getCarrier_Note_No());
        proc.setString(35, declDto.getLicense_Code());
        proc.setString(36, declDto.getApprove_Code());
        proc.setString(37, declDto.getProd_Reg_No());
        proc.setString(38, declDto.getExchange_Note_Codes());
        proc.setString(39, declDto.getExchange_Note_Num());
        proc.setString(40, declDto.getPack_Cap_Resu_Codes());
        proc.setString(41, declDto.getPack_Use_Resu_Codes());
        proc.setString(42, declDto.getSheet_Type_Codes());
        proc.setString(43, declDto.getCert_Type_Codes());
        proc.setString(44, declDto.getCert_Originals());
        proc.setString(45, declDto.getCert_Copies());
        proc.setString(46, declDto.getSpecial_Require());
        proc.setString(47, declDto.getMark_No());
        proc.setString(48, declDto.getValue_Checkup_Flag());
        proc.setString(49, declDto.getInsp_Mode_Code());
        proc.setString(50, declDto.getInsp_Org_Code());
        proc.setString(51, declDto.getInsp_Dept_1());
        proc.setString(52, declDto.getInsp_Dept_2());
        proc.setString(53, declDto.getInsp_Dept_3());
        proc.setString(54, declDto.getInsp_Dept_4());
        proc.setString(55, declDto.getInsp_Dept_5());
        proc.setString(56, declDto.getDecl_Type_Code());
        proc.setString(57, declDto.getProcess_Status());
        proc.setString(58, declDto.getFee_Status());
        proc.setString(59, declDto.getValues_USD());
        proc.setString(60, declDto.getValues_RMB());
        proc.setString(61, declDto.getOperator_Code());
        proc.setString(62, declDto.getOperate_Date());
        proc.setString(63, declDto.getStat_Flag());
        proc.setString(64, declDto.getWaste_Flag());
        proc.setString(65, declDto.getRelease_Status());
        proc.setString(66, declDto.getCheckup_Type_Code());
        proc.setString(67, declDto.getCheckup_Work_Code());
        proc.setString(68, declDto.getOrg_Code());
        proc.setString(69, declDto.getDept_Code());
        proc.setString(70, declDto.getDest_Org_Code());
        proc.setString(71, declDto.getFlow_Flag());
        proc.setString(72, declDto.getTrans_Flag());
        proc.setString(73, declDto.getInputer_Code());
        proc.setString(74, declDto.getInput_Date());
        proc.setString(75, declDto.getEnt_Decl_No());
        proc.setString(76, declDto.getO_I_Flag());
        proc.setString(77, declDto.getChg_Org_Code());
        proc.setString(78, declDto.getChg_Person_Code());
        proc.setString(79, declDto.getChg_Date());
        proc.setString(80, declDto.getCheck_Flag());
        proc.setString(81, declDto.getInput_Org_Code());
        proc.setString(82, declDto.getDECL_FLAG());
        proc.setString(83, declDto.getCUSTOM_CODE());
        proc.setString(84, declDto.getAUTO_PASS_FLAG());
        proc.setString(85, declDto.getAUTO_CHECK_FLAG());
        proc.setString(86, declDto.getBACK_TRANSPORT_FLAG());
        proc.setString(87, declDto.getCONTACTOR());
        proc.setString(88, declDto.getTELEPHONE());
        proc.setString(89, declDto.getPROCESS_FLAG());
        proc.setString(90, declDto.getMONITOR_PASS_FLAG());
        proc.setString(91, declDto.getCOMPUTE_PASS_FLAG());
        proc.setString(92, declDto.getTRANS_MEANS_NAME());
        proc.setString(93, declDto.getMONITOR_FLAG());
        proc.setString(94, declDto.getSPOTTEST_FLAG());
        proc.setString(95, declDto.getCOMB_BATCH_NO());
        proc.setString(96, declDto.getRESEND_NUM());
        proc.setString(97, declDto.getCHANGE_INSP_DEPT_FLAG());
        proc.setString(98, declDto.getCIQ2000_ASSIGN_FLAG());
        proc.setString(99, declDto.getMonitor_Decl_Flag());
        proc.setString(100, declDto.getSEQ_NUM());
        proc.registerOutParameter(101, Types.INTEGER);
        proc.execute();
        retCode = proc.getInt(101);
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        log.error("num9", e);
    } catch (Exception e) {
        log.error("num10", e);
    } finally {
        try {
            if (proc != null) {
                proc.close();
            }
            if (conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            log.error("num11", e);
        }
    }
    return retCode;
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetMSSql.CFInternetMSSqlSchema.java

public boolean isSystemUser(CFInternetAuthorization Authorization) {
    final String S_ProcName = "isSystemUser";
    if (!inTransaction) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }//w w  w  .  jav a2 s  . c o m
    CallableStatement stmtSecurityCheck = null;
    try {
        final String sql = "exec sp_is_system_user ?, ?";
        stmtSecurityCheck = cnx.prepareCall(sql);
        stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER);
        stmtSecurityCheck.setString(2, Authorization.getSecUserId().toString());
        stmtSecurityCheck.execute();
        int isAuthorized = stmtSecurityCheck.getInt(1);
        if (isAuthorized == 0) {
            return (false);
        } else {
            return (true);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtSecurityCheck != null) {
            try {
                stmtSecurityCheck.close();
            } catch (SQLException e) {
            }
            stmtSecurityCheck = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetMSSql.CFInternetMSSqlSchema.java

public boolean isClusterUser(CFInternetAuthorization Authorization, long clusterId, String secGroupName) {
    final String S_ProcName = "isClusterUser";
    if (!inTransaction) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }//  w w  w  .  j  ava 2s .c om
    CallableStatement stmtSecurityCheck = null;
    try {
        final String sql = "exec sp_is_cluster_user ?, ?, ?, ?";
        stmtSecurityCheck = cnx.prepareCall(sql);
        stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER);
        stmtSecurityCheck.setLong(2, clusterId);
        stmtSecurityCheck.setString(3, secGroupName);
        stmtSecurityCheck.setString(4, Authorization.getSecUserId().toString());
        stmtSecurityCheck.execute();
        int isAuthorized = stmtSecurityCheck.getInt(1);
        if (isAuthorized == 0) {
            return (false);
        } else {
            return (true);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtSecurityCheck != null) {
            try {
                stmtSecurityCheck.close();
            } catch (SQLException e) {
            }
            stmtSecurityCheck = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetMSSql.CFInternetMSSqlSchema.java

public boolean isTenantUser(CFInternetAuthorization Authorization, long tenantId, String secGroupName) {
    final String S_ProcName = "isTenantUser";
    if (!inTransaction) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }//from w  ww.  ja v  a 2 s. c o m
    CallableStatement stmtSecurityCheck = null;
    try {
        final String sql = "exec sp_is_tenant_user ?, ?, ?, ?";
        stmtSecurityCheck = cnx.prepareCall(sql);
        stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER);
        stmtSecurityCheck.setLong(2, tenantId);
        stmtSecurityCheck.setString(3, secGroupName);
        stmtSecurityCheck.setString(4, Authorization.getSecUserId().toString());
        stmtSecurityCheck.execute();
        int isAuthorized = stmtSecurityCheck.getInt(1);
        if (isAuthorized == 0) {
            return (false);
        } else {
            return (true);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtSecurityCheck != null) {
            try {
                stmtSecurityCheck.close();
            } catch (SQLException e) {
            }
            stmtSecurityCheck = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseClusterTable.java

public int nextSecAppIdGen(CFInternetAuthorization Authorization, CFInternetClusterPKey PKey) {
    final String S_ProcName = "nextSecAppIdGen";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }//from   www.j  a v a  2s. c  om
    Connection cnx = schema.getCnx();
    long Id = PKey.getRequiredId();

    CallableStatement stmtSelectNextSecAppIdGen = null;
    try {
        String sql = "{ call sp_next_secappidgen( ?" + ", " + "?" + " ) }";
        stmtSelectNextSecAppIdGen = cnx.prepareCall(sql);
        int argIdx = 1;
        stmtSelectNextSecAppIdGen.registerOutParameter(argIdx++, java.sql.Types.INTEGER);
        stmtSelectNextSecAppIdGen.setLong(argIdx++, Id);
        stmtSelectNextSecAppIdGen.execute();
        int nextId = stmtSelectNextSecAppIdGen.getInt(1);
        return (nextId);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtSelectNextSecAppIdGen != null) {
            try {
                stmtSelectNextSecAppIdGen.close();
            } catch (SQLException e) {
            }
            stmtSelectNextSecAppIdGen = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseClusterTable.java

public int nextSecFormIdGen(CFInternetAuthorization Authorization, CFInternetClusterPKey PKey) {
    final String S_ProcName = "nextSecFormIdGen";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }/* ww  w  .j  av a 2s . c o m*/
    Connection cnx = schema.getCnx();
    long Id = PKey.getRequiredId();

    CallableStatement stmtSelectNextSecFormIdGen = null;
    try {
        String sql = "{ call sp_next_secformidgen( ?" + ", " + "?" + " ) }";
        stmtSelectNextSecFormIdGen = cnx.prepareCall(sql);
        int argIdx = 1;
        stmtSelectNextSecFormIdGen.registerOutParameter(argIdx++, java.sql.Types.INTEGER);
        stmtSelectNextSecFormIdGen.setLong(argIdx++, Id);
        stmtSelectNextSecFormIdGen.execute();
        int nextId = stmtSelectNextSecFormIdGen.getInt(1);
        return (nextId);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtSelectNextSecFormIdGen != null) {
            try {
                stmtSelectNextSecFormIdGen.close();
            } catch (SQLException e) {
            }
            stmtSelectNextSecFormIdGen = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseClusterTable.java

public int nextSecGroupIdGen(CFInternetAuthorization Authorization, CFInternetClusterPKey PKey) {
    final String S_ProcName = "nextSecGroupIdGen";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }//from w  w w  .  j  a v  a2 s . c om
    Connection cnx = schema.getCnx();
    long Id = PKey.getRequiredId();

    CallableStatement stmtSelectNextSecGroupIdGen = null;
    try {
        String sql = "{ call sp_next_secgroupidgen( ?" + ", " + "?" + " ) }";
        stmtSelectNextSecGroupIdGen = cnx.prepareCall(sql);
        int argIdx = 1;
        stmtSelectNextSecGroupIdGen.registerOutParameter(argIdx++, java.sql.Types.INTEGER);
        stmtSelectNextSecGroupIdGen.setLong(argIdx++, Id);
        stmtSelectNextSecGroupIdGen.execute();
        int nextId = stmtSelectNextSecGroupIdGen.getInt(1);
        return (nextId);
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtSelectNextSecGroupIdGen != null) {
            try {
                stmtSelectNextSecGroupIdGen.close();
            } catch (SQLException e) {
            }
            stmtSelectNextSecGroupIdGen = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseSchema.java

public boolean isSystemUser(CFInternetAuthorization Authorization) {
    if (!inTransaction) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), "isSystemUser",
                "Not in a transaction");
    }/*from w  w w .  ja va 2 s .  co  m*/
    CallableStatement stmtSecurityCheck = null;
    try {
        final String sql = "{ call sp_is_system_user( ?, ? ) }";
        stmtSecurityCheck = cnx.prepareCall(sql);
        stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER);
        stmtSecurityCheck.setString(2, Authorization.getSecUserId().toString());
        stmtSecurityCheck.execute();
        int isAuthorized = stmtSecurityCheck.getInt(1);
        if (isAuthorized == 0) {
            return (false);
        } else {
            return (true);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "isSystemUser", e);
    } finally {
        if (stmtSecurityCheck != null) {
            try {
                stmtSecurityCheck.close();
            } catch (SQLException e) {
            }
            stmtSecurityCheck = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseSchema.java

public boolean isClusterUser(CFInternetAuthorization Authorization, long clusterId, String secGroupName) {
    if (!inTransaction) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), "isClusterUser",
                "Not in a transaction");
    }//w  w  w. j  a va 2s  .  c o  m
    CallableStatement stmtSecurityCheck = null;
    try {
        final String sql = "{ call sp_is_cluster_user( ?, ?, ?, ? ) }";
        stmtSecurityCheck = cnx.prepareCall(sql);
        stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER);
        stmtSecurityCheck.setLong(2, clusterId);
        stmtSecurityCheck.setString(3, secGroupName);
        stmtSecurityCheck.setString(4, Authorization.getSecUserId().toString());
        stmtSecurityCheck.execute();
        int isAuthorized = stmtSecurityCheck.getInt(1);
        if (isAuthorized == 0) {
            return (false);
        } else {
            return (true);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "isClusterUser", e);
    } finally {
        if (stmtSecurityCheck != null) {
            try {
                stmtSecurityCheck.close();
            } catch (SQLException e) {
            }
            stmtSecurityCheck = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetSybase.CFInternetSybaseSchema.java

public boolean isTenantUser(CFInternetAuthorization Authorization, long tenantId, String secGroupName) {
    if (!inTransaction) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), "isTenantUser",
                "Not in a transaction");
    }/* www . j a  va 2  s .  co  m*/
    CallableStatement stmtSecurityCheck = null;
    try {
        final String sql = "{ call sp_is_tenant_user( ?, ?, ?, ? ) }";
        stmtSecurityCheck = cnx.prepareCall(sql);
        stmtSecurityCheck.registerOutParameter(1, java.sql.Types.INTEGER);
        stmtSecurityCheck.setLong(2, tenantId);
        stmtSecurityCheck.setString(3, secGroupName);
        stmtSecurityCheck.setString(4, Authorization.getSecUserId().toString());
        stmtSecurityCheck.execute();
        int isAuthorized = stmtSecurityCheck.getInt(1);
        if (isAuthorized == 0) {
            return (false);
        } else {
            return (true);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), "isTenantUser", e);
    } finally {
        if (stmtSecurityCheck != null) {
            try {
                stmtSecurityCheck.close();
            } catch (SQLException e) {
            }
            stmtSecurityCheck = null;
        }
    }
}