Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在spring中使用字符串保存blob对象_Java_Spring_Model View Controller_Jdbc_Spring Jdbc - Fatal编程技术网

Java 在spring中使用字符串保存blob对象

Java 在spring中使用字符串保存blob对象,java,spring,model-view-controller,jdbc,spring-jdbc,Java,Spring,Model View Controller,Jdbc,Spring Jdbc,我的数据库中有blob数据列,我的客户机已经准备好编写SP存储过程来更新和插入表中的数据 我正在使用此函数在DB中存储或更新blob对象 @Override public String saveInvoicePdfBlob(String userId, String invoiceNo,String transactionNo, Blob pdfBlob) throws DataBaseException{ String plSql = "\n"; plSql += "decla

我的数据库中有blob数据列,我的客户机已经准备好编写SP存储过程来更新和插入表中的数据

我正在使用此函数在DB中存储或更新blob对象

@Override
public String saveInvoicePdfBlob(String userId, String invoiceNo,String transactionNo, Blob pdfBlob) throws DataBaseException{
    String plSql = "\n";
    plSql += "declare" + "\n";
    plSql += "  resp varchar2(1000);" + "\n";
    plSql += "begin" + "\n";
    plSql += "resp := srv.payment."+AppConstants.SAVE_INVOICE_PDFURL+"('"+invoiceNo+"',"
            +"'"+transactionNo+"',"
            +""+pdfBlob+""
            +");"+ "\n";
    plSql += "  ? := resp;" + "\n";
    plSql += "end;" + "\n";
    logger.debug("saveInvoicePdfUrl SQL : {} ", plSql);
    String result = jdbcDAOSupport.execReqSql(
            dataSource, plSql);
    return result;
}
以下是我在jdbcDAOSupportLayer中的execReqSql函数:-

public String execReqSql(final DataSource dataSource, final String sql) throws RegistrationException
{

    String result = "";
    Connection connection = null;
    CallableStatement cs = null;
    try
    {
        connection = dataSource.getConnection();
        cs = connection.prepareCall(sql);
        cs.registerOutParameter(1, Types.VARCHAR);
        cs.execute();
        result = cs.getString(1);
    }
    catch (SQLException sqle)
    {   
        log.debug("Error occured : {} ",sqle.getMessage());
        String errorMessage="The system is currently unavailable.";
        throw new RegistrationException(errorMessage);
    }
    catch (Exception e)
    {   
        log.debug("Error occured : {} ",e.getMessage());
        String errorMessage="The system is currently unavailable.";
        throw new RegistrationException(errorMessage);
    }
    finally
    {
        try
        {
            if (null != cs)
            {
                cs.close();
            }
        }
        catch (SQLException e)
        {
            String errorMessage="The system is currently unavailable.";
            log.debug("Error occured : {} ",e.getMessage());
            throw new RegistrationException(errorMessage);
        }
        catch (Exception e)
        {   
            String errorMessage="The system is currently unavailable.";
            log.debug("Error occured : {} ",e.getMessage());
            throw new RegistrationException(errorMessage);
        }
        try
        {
            if (null != connection)
            {
                connection.close();
            }
        }
        catch (SQLException e)
        {   
            String errorMessage="The system is currently unavailable.";
            log.debug("Error occured : {} ",e.getMessage());
            throw new RegistrationException(errorMessage);
        }
        catch (Exception e)
        {   
            String errorMessage="The system is currently unavailable.";
            throw new RegistrationException(errorMessage);
        }
    }
    return result;
}
但每次调用此函数时,都会出现以下异常:-

 Wrong number of types of arguments in call to function.
 ORA-06550:line 5,column 1;
 PL/SQL: Statement Ignored.