Example usage for java.sql CallableStatement registerOutParameter

List of usage examples for java.sql CallableStatement registerOutParameter

Introduction

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

Prototype

default void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException 

Source Link

Document

Registers the OUT parameter named parameterName to the JDBC type sqlType .

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleISOCurrencyTable.java

public CFAstISOCurrencyBuff readBuffByCcyCdIdx(CFAstAuthorization Authorization, String ISOCode) {
    final String S_ProcName = "readBuffByCcyCdIdx";
    ResultSet resultSet = null;/*from   ww w  .  jav a 2s .  c  om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCcyCdIdx = null;
    try {
        stmtReadBuffByCcyCdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_ccybyccycdidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCcyCdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCcyCdIdx.setString(argIdx++, ISOCode);
        stmtReadBuffByCcyCdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCcyCdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstISOCurrencyBuff buff = unpackISOCurrencyResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCcyCdIdx != null) {
            try {
                stmtReadBuffByCcyCdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCcyCdIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleISOCurrencyTable.java

public CFAstISOCurrencyBuff readBuffByCcyNmIdx(CFAstAuthorization Authorization, String Name) {
    final String S_ProcName = "readBuffByCcyNmIdx";
    ResultSet resultSet = null;//from w w  w .j  ava 2s  . c om
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCcyNmIdx = null;
    try {
        stmtReadBuffByCcyNmIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_ccybyccynmidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCcyNmIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyNmIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCcyNmIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCcyNmIdx.setString(argIdx++, Name);
        stmtReadBuffByCcyNmIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCcyNmIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstISOCurrencyBuff buff = unpackISOCurrencyResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCcyNmIdx != null) {
            try {
                stmtReadBuffByCcyNmIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCcyNmIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleISOCurrencyTable.java

public CFFswISOCurrencyBuff readBuffByCcyCdIdx(CFFswAuthorization Authorization, String ISOCode) {
    final String S_ProcName = "readBuffByCcyCdIdx";
    ResultSet resultSet = null;//from www  .  ja  va2  s  .  c  o m
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCcyCdIdx = null;
    try {
        stmtReadBuffByCcyCdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_ccybyccycdidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCcyCdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCcyCdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyCdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCcyCdIdx.setString(argIdx++, ISOCode);
        stmtReadBuffByCcyCdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCcyCdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFFswISOCurrencyBuff buff = unpackISOCurrencyResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCcyCdIdx != null) {
            try {
                stmtReadBuffByCcyCdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCcyCdIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleISOCurrencyTable.java

public CFFswISOCurrencyBuff readBuffByCcyNmIdx(CFFswAuthorization Authorization, String Name) {
    final String S_ProcName = "readBuffByCcyNmIdx";
    ResultSet resultSet = null;/*from  ww w . j  av a 2s . c  o m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByCcyNmIdx = null;
    try {
        stmtReadBuffByCcyNmIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_iso_ccybyccynmidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByCcyNmIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyNmIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByCcyNmIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByCcyNmIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByCcyNmIdx.setString(argIdx++, Name);
        stmtReadBuffByCcyNmIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByCcyNmIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFFswISOCurrencyBuff buff = unpackISOCurrencyResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByCcyNmIdx != null) {
            try {
                stmtReadBuffByCcyNmIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByCcyNmIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleSecAppTable.java

public CFAccSecAppBuff readBuffByUJEEMountIdx(CFAccAuthorization Authorization, long ClusterId,
        String JEEMountName) {/*from   ww w  .ja va  2s . c o m*/
    final String S_ProcName = "readBuffByUJEEMountIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUJEEMountIdx = null;
    try {
        stmtReadBuffByUJEEMountIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_secappbyujeemountidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUJEEMountIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++, ClusterId);
        stmtReadBuffByUJEEMountIdx.setString(argIdx++, JEEMountName);
        stmtReadBuffByUJEEMountIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUJEEMountIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAccSecAppBuff buff = unpackSecAppResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByUJEEMountIdx != null) {
            try {
                stmtReadBuffByUJEEMountIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUJEEMountIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleSecAppTable.java

public CFAstSecAppBuff readBuffByUJEEMountIdx(CFAstAuthorization Authorization, long ClusterId,
        String JEEMountName) {// www .ja  va 2  s  .  c om
    final String S_ProcName = "readBuffByUJEEMountIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUJEEMountIdx = null;
    try {
        stmtReadBuffByUJEEMountIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_secappbyujeemountidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUJEEMountIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++, ClusterId);
        stmtReadBuffByUJEEMountIdx.setString(argIdx++, JEEMountName);
        stmtReadBuffByUJEEMountIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUJEEMountIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstSecAppBuff buff = unpackSecAppResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByUJEEMountIdx != null) {
            try {
                stmtReadBuffByUJEEMountIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUJEEMountIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstOracle.CFAstOracleSecAppTable.java

public CFAstSecAppBuff readBuffByUJEEMountIdx(CFAstAuthorization Authorization, long ClusterId,
        String JEEMountName) {/*from   w  w  w. ja va2 s. c  o m*/
    final String S_ProcName = "readBuffByUJEEMountIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUJEEMountIdx = null;
    try {
        stmtReadBuffByUJEEMountIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secappbyujeemountidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUJEEMountIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++, ClusterId);
        stmtReadBuffByUJEEMountIdx.setString(argIdx++, JEEMountName);
        stmtReadBuffByUJEEMountIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUJEEMountIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstSecAppBuff buff = unpackSecAppResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByUJEEMountIdx != null) {
            try {
                stmtReadBuffByUJEEMountIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUJEEMountIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswOracle.CFFswOracleSecAppTable.java

public CFFswSecAppBuff readBuffByUJEEMountIdx(CFFswAuthorization Authorization, long ClusterId,
        String JEEMountName) {/*www .  ja v  a 2s  . c  om*/
    final String S_ProcName = "readBuffByUJEEMountIdx";
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByUJEEMountIdx = null;
    try {
        stmtReadBuffByUJEEMountIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secappbyujeemountidx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByUJEEMountIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByUJEEMountIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++,
                (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByUJEEMountIdx.setLong(argIdx++, ClusterId);
        stmtReadBuffByUJEEMountIdx.setString(argIdx++, JEEMountName);
        stmtReadBuffByUJEEMountIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByUJEEMountIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFFswSecAppBuff buff = unpackSecAppResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByUJEEMountIdx != null) {
            try {
                stmtReadBuffByUJEEMountIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByUJEEMountIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccOracle.CFAccOracleContactListTable.java

public CFAccContactListBuff readBuffByIdIdx(CFAccAuthorization Authorization, long TenantId,
        long ContactListId) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;/*from   ww  w .  j av  a 2  s  .c om*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".rd_ctclstbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByIdIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByIdIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByIdIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByIdIdx.setLong(argIdx++, TenantId);
        stmtReadBuffByIdIdx.setLong(argIdx++, ContactListId);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAccContactListBuff buff = unpackContactListResultSetToBuff(resultSet);
                if (resultSet.next()) {
                    resultSet.last();
                    throw CFLib.getDefaultExceptionFactory().newRuntimeException(getClass(), S_ProcName,
                            "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
                }
                return (buff);
            } else {
                return (null);
            }
        } catch (SQLException e) {
            return (null);
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
        if (stmtReadBuffByIdIdx != null) {
            try {
                stmtReadBuffByIdIdx.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByIdIdx = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstSybase.CFAstSybaseTenantTable.java

public long nextDomainIdGen(CFAstAuthorization Authorization, CFAstTenantPKey PKey) {
    final String S_ProcName = "nextDomainIdGen";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Not in a transaction");
    }// w  ww .  ja v a2s .c  o m
    Connection cnx = schema.getCnx();
    long Id = PKey.getRequiredId();

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