1

I am calling a stored proc, which returns around 20 fields. One of those is a clob.

I am using Spring Jdbc, and just cannot handle the clob value. Any operation on the clob, throws closed connection error. The clob contains a large chunk of xml data. I've tried everything, from using getCharacterStream, Readers, ByteArrays without any luck. Even checking the length of the clob throws a closed connection error.

Sample code

SqlParameterSource params = new MapSqlParameterSource()
        .addValue("obj_key", objkey)



SimpleJdbcCall jdbcCall = new SimpleJdbcCall(provide())
        .withSchemaName("aa")
        .withCatalogName("bbb")
        .withProcedureName("cccccc")
        .declareParameters(
            new SqlParameter("obj_key", Types.NUMERIC),
            new SqlOutParameter("tv_flag", Types.NUMERIC),
            new SqlOutParameter("dtv_flag", Types.NUMERIC),
            new SqlOutParameter("dig_flag", Types.NUMERIC),
            new SqlOutParameter("in_flag", Types.NUMERIC),
            new SqlOutParameter("rfs_status", Types.VARCHAR),
            new SqlOutParameter("phone_flag", Types.NUMERIC),
            new SqlOutParameter("chan", Types.VARCHAR),
            new SqlOutParameter("prods", Types.VARCHAR),
            new SqlOutParameter("prods_clob", Types.CLOB),          ************this field
            new SqlOutParameter("prod_all", Types.NUMERIC),
            new SqlOutParameter("remainder", Types.NUMERIC),
            new SqlOutParameter("extrainfo", Types.VARCHAR),
            new SqlOutParameter("provider", Types.VARCHAR),
            new SqlOutParameter("areacode", Types.NUMERIC),
            new SqlOutParameter("moduldata", Types.VARCHAR));

    Map<String, Object> results = jdbcCall.execute(params);
    
    Clob clobProdPaks = (Clob) results.get("prods_clob");



clobProdPaks.length() >>>>>connection closed
clobProdPaks.getCharacterStream() >>>>>connection closed

Can anyone kindly suggest on how to handle this clob field? I don't want to use a callableStatement with lots of ?????????. Ive trimmed the out params above, there lots more.

Thanks in advance.

Amjad Riaz
  • 11
  • 1

0 Answers0