{"record":{"id":"d2f98b592e65713a","repo":"apache/shardingsphere","slug":"unsupported-blr-type-s","errorCode":null,"errorMessage":"Unsupported BLR type: %s","messagePattern":"Unsupported BLR type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlr.java","lineNumber":201,"sourceCode":"    \n    private static int fixedLengthOf(final int blrType) {\n        if (BlrConstants.blr_short == blrType) {\n            return Short.BYTES;\n        }\n        if (BlrConstants.blr_long == blrType || BlrConstants.blr_float == blrType || BlrConstants.blr_sql_date == blrType || BlrConstants.blr_sql_time == blrType) {\n            return Integer.BYTES;\n        }\n        if (BlrConstants.blr_int64 == blrType || BlrConstants.blr_double == blrType || BlrConstants.blr_d_float == blrType\n                || BlrConstants.blr_quad == blrType || BlrConstants.blr_timestamp == blrType) {\n            return Long.BYTES;\n        }\n        if (BlrConstants.blr_int128 == blrType) {\n            return Long.BYTES * 2;\n        }\n        if (BlrConstants.blr_bool == blrType) {\n            return Byte.BYTES;\n        }\n        throw new IllegalArgumentException(\"Unsupported BLR type: \" + blrType);\n    }\n    \n    private static int alignmentOf(final int blrType) {\n        if (BlrConstants.blr_text == blrType || BlrConstants.blr_text2 == blrType || BlrConstants.blr_bool == blrType) {\n            return 1;\n        }\n        if (BlrConstants.blr_varying == blrType || BlrConstants.blr_varying2 == blrType || BlrConstants.blr_short == blrType) {\n            return Short.BYTES;\n        }\n        if (BlrConstants.blr_int64 == blrType || BlrConstants.blr_double == blrType || BlrConstants.blr_d_float == blrType) {\n            return Long.BYTES;\n        }\n        return Integer.BYTES;\n    }\n    \n    private static int alignTo(final int value, final int alignment) {\n        return value + alignment - 1 & ~(alignment - 1);\n    }","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlr.java#L183-L219","documentation":"SQLFeatureNotSupportedException thrown by updateClob(String, Reader) on SQL federation ResultSets. The label+Reader overload is final and throws in AbstractUnsupportedUpdateOperationSQLFederationResultSet, whose entire role is to enumerate the ResultSet update operations SQL federation does not support. Federated cursors are CONCUR_READ_ONLY, so streaming character data into a named column of the current row is refused before the Reader is read.","triggerScenarios":"Calling rs.updateClob(\"body\", reader) on a federated ResultSet and then rs.updateRow(). Seen in label-based writers that pipe a Reader of text into a CLOB column during row iteration.","commonSituations":"Report/document generation writing output back to a CLOB in place; migration to ShardingSphere JDBC or proxy where federation now serves the query; generic persistence layers exposing the full JDBC update API to application code.","solutions":["Use an UPDATE statement with ps.setCharacterStream bound in SQL by column name instead of the cursor API","Close the Reader in the caller after the failed/succeeded call; the federation path never reads it","Probe rs.getConcurrency() before entering edit flows and use DML when CONCUR_READ_ONLY","Avoid federation for editable result sets by adjusting the query or federation configuration"],"exampleFix":"// before\nrs.updateClob(\"body\", stringReader); // SQLFeatureNotSupportedException\n\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"UPDATE docs SET body = ? WHERE id = ?\")) {\n    ps.setCharacterStream(1, stringReader);\n    ps.setLong(2, rs.getLong(\"id\"));\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {\n    // label+Reader CLOB write unsupported: use UPDATE + setCharacterStream\n}","typeGuard":null,"tryCatchPattern":"try {\n    rs.updateClob(\"body\", reader);\n} catch (SQLFeatureNotSupportedException e) {\n    // federation cursor read-only; emit UPDATE DML and manage reader lifecycle\n}","preventionTips":["Convert label-based cursor writes to DML in a single layer","Check concurrency before entering edit flows","Add regression tests asserting DML fallback works when federation is active"],"tags":["jdbc","resultset","sql-federation","read-only","clob","streaming"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}