Example usage for java.sql Connection prepareCall

List of usage examples for java.sql Connection prepareCall

Introduction

In this page you can find the example usage for java.sql Connection prepareCall.

Prototype

CallableStatement prepareCall(String sql) throws SQLException;

Source Link

Document

Creates a CallableStatement object for calling database stored procedures.

Usage

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

public void deleteServiceType(CFAstAuthorization Authorization, CFAstServiceTypeBuff Buff) {
    final String S_ProcName = "deleteServiceType";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {//from  www . j a  v a2 s  . co m
        int ServiceTypeId = Buff.getRequiredServiceTypeId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerSchemaDbName()
                + ".dl_svctype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setInt(argIdx++, ServiceTypeId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        stmtDeleteByPKey.execute();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtDeleteByPKey != null) {
            try {
                stmtDeleteByPKey.close();
            } catch (SQLException e) {
            }
            stmtDeleteByPKey = null;
        }
    }
}

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

public void deleteMimeType(CFAstAuthorization Authorization, CFAstMimeTypeBuff Buff) {
    final String S_ProcName = "deleteMimeType";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {/*from www . j av a2  s.c o m*/
        int MimeTypeId = Buff.getRequiredMimeTypeId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_mimetype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setInt(argIdx++, MimeTypeId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        stmtDeleteByPKey.execute();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtDeleteByPKey != null) {
            try {
                stmtDeleteByPKey.close();
            } catch (SQLException e) {
            }
            stmtDeleteByPKey = null;
        }
    }
}

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

public void deleteServiceType(CFAstAuthorization Authorization, CFAstServiceTypeBuff Buff) {
    final String S_ProcName = "deleteServiceType";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {/*  w  w  w.java 2  s. c  o m*/
        int ServiceTypeId = Buff.getRequiredServiceTypeId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_svctype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setInt(argIdx++, ServiceTypeId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        stmtDeleteByPKey.execute();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtDeleteByPKey != null) {
            try {
                stmtDeleteByPKey.close();
            } catch (SQLException e) {
            }
            stmtDeleteByPKey = null;
        }
    }
}

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

public void deleteMimeType(CFFswAuthorization Authorization, CFFswMimeTypeBuff Buff) {
    final String S_ProcName = "deleteMimeType";
    Connection cnx = schema.getCnx();
    CallableStatement stmtDeleteByPKey = null;
    try {/*from  w w w  . j  ava  2  s. c o m*/
        int MimeTypeId = Buff.getRequiredMimeTypeId();
        stmtDeleteByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".dl_mimetype( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtDeleteByPKey.setInt(argIdx++, MimeTypeId);
        stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
        ;
        stmtDeleteByPKey.execute();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (stmtDeleteByPKey != null) {
            try {
                stmtDeleteByPKey.close();
            } catch (SQLException e) {
            }
            stmtDeleteByPKey = null;
        }
    }
}

From source file:dbProcs.Getter.java

/**
 * This method prepares the incremental module menu. This is when Security Shepherd is in "Game Mode".
 * Users are presented with one uncompleted module at a time. This method also returns a script to be executed every time the menu is chanegd.
 * This is script defines the animation and operations to be carried out when the menu is interacted with
 * @param ApplicationRoot The running context of the application.
 * @param userId The user identifier of the user.
 * @param csrfToken The cross site request forgery token
 * @return A HTML menu of a users current module progress and a script for interaction with this menu
 *///from w w  w  .  j  a v a2  s .c o  m
public static String getIncrementalModules(String ApplicationRoot, String userId, String lang,
        String csrfToken) {
    log.debug("*** Getter.getIncrementalChallenges ***");
    String output = new String();
    Encoder encoder = ESAPI.encoder();
    Connection conn = Database.getCoreConnection(ApplicationRoot);

    Locale.setDefault(new Locale("en"));
    Locale locale = new Locale(lang);
    ResourceBundle bundle = ResourceBundle.getBundle("i18n.text", locale);
    ResourceBundle levelNames = ResourceBundle.getBundle("i18n.moduleGenerics.moduleNames", locale);

    try {
        CallableStatement callstmt = conn.prepareCall("call moduleIncrementalInfo(?)");
        callstmt.setString(1, userId);
        log.debug("Gathering moduleIncrementalInfo ResultSet");
        ResultSet modules = callstmt.executeQuery();
        log.debug("Opening Result Set from moduleIncrementalInfo");
        boolean lastRow = false;
        boolean completedModules = false;

        //Preparing first Category header; "Completed"
        output = "<li><a id='completedList' href='javascript:;'><div class='menuButton'>"
                + bundle.getString("getter.button.completed") + "</div></a>\n"
                + "<ul id='theCompletedList' style='display: none;' class='levelList'>";

        while (modules.next() && !lastRow) {
            //For each row, prepair the modules the users can select
            if (modules.getString(4) != null) //If not Last Row
            {
                completedModules = true;
                output += "<li>";
                output += "<a class='lesson' id='" + encoder.encodeForHTMLAttribute(modules.getString(3))
                        + "' href='javascript:;'>"
                        + encoder.encodeForHTML(levelNames.getString(modules.getString(1))) + "</a>";
                output += "</li>";
            } else {
                lastRow = true;
                //Last Row - Highlighed Next Challenge
                if (completedModules) {
                    output += "</ul></li><li>";
                } else {
                    //NO completed modules, so dont show any...
                    output = new String();
                }

                //Second category - Uncompleted
                output += "<a class='lesson' id='" + encoder.encodeForHTMLAttribute(modules.getString(3))
                        + "' href='javascript:;'>" + "<div class='menuButton'>"
                        + bundle.getString("getter.button.nextChallenge") + "</div>" + "</a>";
                output += "</li>";
            }
        }

        if (!lastRow) //If true, then the user has completed all challenges
        {
            output += "<h2 id='uncompletedList'><a href='javascript:;'>"
                    + bundle.getString("getter.button.finished") + "</a></h2>\n" + "</li>";
        }
        if (output.isEmpty()) //If this method has gone so far without any output, create a error message
        {
            output = "<li><a href='javascript:;'>" + bundle.getString("getter.button.noModulesFound")
                    + "</a></li>";
        } else //final tags to ensure valid HTML
        {
            log.debug("Appending End tags");
            //output += "</ul></li>"; //Commented Out to prevent Search Box being pushed into Footer
        }

        //This is the script for menu interaction
        output += "<script>applyMenuButtonActionsCtfMode('" + encoder.encodeForHTML(csrfToken) + "', \""
                + encoder.encodeForHTML(bundle.getString("generic.text.sorryError")) + "\");</script>";
    } catch (Exception e) {
        log.error("Challenge Retrieval: " + e.toString());
    }
    Database.closeConnection(conn);
    log.debug("*** END getIncrementalChallenges() ***");
    return output;
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleAuditActionTable.java

public CFEnSyntaxAuditActionBuff readBuff(CFEnSyntaxAuthorization Authorization,
        CFEnSyntaxAuditActionPKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }//from w w  w  .  j a v a  2 s. c o m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByPKey = null;
    try {
        short AuditActionId = PKey.getRequiredAuditActionId();

        stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByPKey.setShort(argIdx++, AuditActionId);
        stmtReadBuffByPKey.execute();
        resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxAuditActionBuff buff = unpackAuditActionResultSetToBuff(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 (stmtReadBuffByPKey != null) {
            try {
                stmtReadBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByPKey = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxOracle.CFEnSyntaxOracleAuditActionTable.java

public CFEnSyntaxAuditActionBuff lockBuff(CFEnSyntaxAuthorization Authorization,
        CFEnSyntaxAuditActionPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }// ww  w  .j av a  2  s  .c o m
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
        short AuditActionId = PKey.getRequiredAuditActionId();

        stmtLockBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".lck_auditaction( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtLockBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtLockBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtLockBuffByPKey.setShort(argIdx++, AuditActionId);
        stmtLockBuffByPKey.execute();
        resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFEnSyntaxAuditActionBuff buff = unpackAuditActionResultSetToBuff(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 (stmtLockBuffByPKey != null) {
            try {
                stmtLockBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtLockBuffByPKey = null;
        }
    }
}

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

public CFAstSecDeviceBuff readBuffByIdIdx(CFAstAuthorization Authorization, UUID SecUserId, String DevName) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;/*w  ww .  j a va  2s .co m*/
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secdevbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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.setString(argIdx++, SecUserId.toString());
        stmtReadBuffByIdIdx.setString(argIdx++, DevName);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFAstSecDeviceBuff buff = unpackSecDeviceResultSetToBuff(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.cffreeswitch.v2_1.CFFswOracle.CFFswOracleSecDeviceTable.java

public CFFswSecDeviceBuff readBuffByIdIdx(CFFswAuthorization Authorization, UUID SecUserId, String DevName) {
    final String S_ProcName = "readBuffByIdIdx";
    ResultSet resultSet = null;//from ww w  .  j  a  va 2  s.com
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByIdIdx = null;
    try {
        stmtReadBuffByIdIdx = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_secdevbyididx( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); 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.setString(argIdx++, SecUserId.toString());
        stmtReadBuffByIdIdx.setString(argIdx++, DevName);
        stmtReadBuffByIdIdx.execute();
        resultSet = (ResultSet) stmtReadBuffByIdIdx.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFFswSecDeviceBuff buff = unpackSecDeviceResultSetToBuff(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_4.CFAsteriskOracle.CFAsteriskOracleMimeTypeTable.java

public CFInternetMimeTypeBuff readBuff(CFSecurityAuthorization Authorization, CFInternetMimeTypePKey PKey) {
    final String S_ProcName = "readBuff";
    if (!schema.isTransactionOpen()) {
        throw CFLib.getDefaultExceptionFactory().newUsageException(getClass(), S_ProcName,
                "Transaction not open");
    }/*from  w w w. jav  a 2  s. c  o  m*/
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtReadBuffByPKey = null;
    try {
        int MimeTypeId = PKey.getRequiredMimeTypeId();

        stmtReadBuffByPKey = cnx.prepareCall("begin " + schema.getLowerDbSchemaName()
                + ".rd_mimetype( ?, ?, ?, ?, ?, ?" + ", " + "?" + " ); end;");
        int argIdx = 1;
        stmtReadBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtReadBuffByPKey.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtReadBuffByPKey.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        stmtReadBuffByPKey.setInt(argIdx++, MimeTypeId);
        stmtReadBuffByPKey.execute();
        resultSet = (ResultSet) stmtReadBuffByPKey.getObject(1);
        if (resultSet == null) {
            return (null);
        }
        try {
            if (resultSet.next()) {
                CFInternetMimeTypeBuff buff = unpackMimeTypeResultSetToBuff(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 (stmtReadBuffByPKey != null) {
            try {
                stmtReadBuffByPKey.close();
            } catch (SQLException e) {
            }
            stmtReadBuffByPKey = null;
        }
    }
}