{"record":{"id":"e01d1c0dc7b70c77","repo":"apache/shardingsphere","slug":"updatebinarystream","errorCode":null,"errorMessage":"updateBinaryStream","messagePattern":"updateBinaryStream","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java","lineNumber":224,"sourceCode":"    \n    @Override\n    public final void updateAsciiStream(final String columnLabel, final InputStream x, final int length) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateAsciiStream\");\n    }\n    \n    @Override\n    public final void updateAsciiStream(final int columnIndex, final InputStream inputStream, final long length) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateAsciiStream\");\n    }\n    \n    @Override\n    public final void updateAsciiStream(final String columnLabel, final InputStream inputStream, final long length) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateAsciiStream\");\n    }\n    \n    @Override\n    public final void updateBinaryStream(final int columnIndex, final InputStream x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateBinaryStream\");\n    }\n    \n    @Override\n    public final void updateBinaryStream(final String columnLabel, final InputStream x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateBinaryStream\");\n    }\n    \n    @Override\n    public final void updateBinaryStream(final int columnIndex, final InputStream x, final int length) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateBinaryStream\");\n    }\n    \n    @Override\n    public final void updateBinaryStream(final String columnLabel, final InputStream x, final int length) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateBinaryStream\");\n    }\n    \n    @Override","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java#L206-L242","documentation":"The federation ResultSet throws SQLFeatureNotSupportedException(\"updateBinaryStream\") from AbstractUnsupportedUpdateOperationSQLFederationResultSet. SQL federation computes merged, read-only results for cross-shard queries (federation engine with Calcite), so binary column updates in place have no backing cursor and every updateBinaryStream overload is an unconditional throw.","triggerScenarios":"Calling rs.updateBinaryStream(columnIndex, inputStream) (two-arg, no length) on a federation ResultSet — e.g. writing BLOB bytes after a federated SELECT — before rs.updateRow().","commonSituations":"Code that updates BLOB columns via positioned updates; enabling SQL federation so a formerly single-shard query now returns SQLFederationResultSet; porting an app from a raw MySQL/PostgreSQL connection to ShardingSphere.","solutions":["Use an explicit UPDATE statement with setBinaryStream to write binary data.","Keep the query off the federation path by adjusting SQL or sharding/federation configuration.","Lint the codebase for ResultSet.update* usage and convert all such flows to statement-based writes."],"exampleFix":"// before\nrs.updateBinaryStream(2, binIn); // throws\nrs.updateRow();\n\n// after\nPreparedStatement ps = conn.prepareStatement(\"UPDATE t_file SET data = ? WHERE id = ?\");\nps.setBinaryStream(1, binIn);\nps.setLong(2, id);\nps.executeUpdate();","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE\n        || rs instanceof org.apache.shardingsphere.sqlfederation.resultset.SQLFederationResultSet) {\n    // use UPDATE + setBinaryStream instead\n}","typeGuard":"boolean isFederationResultSet(ResultSet rs) {\n    return rs instanceof org.apache.shardingsphere.sqlfederation.resultset.SQLFederationResultSet;\n}","tryCatchPattern":"try {\n    rs.updateBinaryStream(col, in);\n} catch (SQLFeatureNotSupportedException e) {\n    // fall back to PreparedStatement UPDATE with setBinaryStream\n}","preventionTips":["Write BLOBs with INSERT/UPDATE statements, not positioned result-set updates.","Check result-set concurrency before attempting updates.","Keep binary-write code driver-agnostic by never relying on updatable cursors."],"tags":["jdbc","sql-federation","resultset","blob","readonly"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}