{"record":{"id":"0b59c30788823bf9","repo":"apache/shardingsphere","slug":"updatesqlxml","errorCode":null,"errorMessage":"updateSQLXML","messagePattern":"updateSQLXML","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java","lineNumber":444,"sourceCode":"    \n    @Override\n    public final void updateArray(final String columnLabel, final Array x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateArray\");\n    }\n    \n    @Override\n    public final void updateRowId(final int columnIndex, final RowId x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateRowId\");\n    }\n    \n    @Override\n    public final void updateRowId(final String columnLabel, final RowId x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateRowId\");\n    }\n    \n    @Override\n    public final void updateSQLXML(final int columnIndex, final SQLXML xmlObject) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateSQLXML\");\n    }\n    \n    @Override\n    public final void updateSQLXML(final String columnLabel, final SQLXML xmlObject) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateSQLXML\");\n    }\n}\n","sourceCodeStart":426,"sourceCodeEnd":452,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java#L426-L452","documentation":"updateSQLXML(int, SQLXML) throws SQLFeatureNotSupportedException on ShardingSphere federation ResultSets. SQLXML updates require driver support for DOM/stream XML binding against an updatable row; the federation layer provides neither, and its updater base class marks the method unsupported.","triggerScenarios":"Calling rs.updateSQLXML(columnIndex, xmlObject) where xmlObject came from conn.createSQLXML(), on a federation-routed SELECT result, then rs.updateRow().","commonSituations":"Applications writing XML documents to XML-typed columns (SQL Server, Oracle, PostgreSQL) through ShardingSphere with sql_federation on; ETL jobs using SQLXML to avoid string serialization.","solutions":["Serialize the XML and write it with a PreparedStatement UPDATE (setSQLXML if supported by the underlying driver, else setString with XML text).","Keep federation result sets read-only in application design.","Re-route the statement away from federation when cursor updates are needed.","Add try-catch fallback in generic XML persistence layers."],"exampleFix":"// before\nSQLXML xml = conn.createSQLXML();\nxml.setString(docXml);\nrs.updateSQLXML(2, xml);\nrs.updateRow();\n\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"UPDATE doc SET payload = ? WHERE id = ?\")) {\n    ps.setString(1, docXml);\n    ps.setLong(2, id);\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE) { throw new IllegalStateException(\"ResultSet is not updatable; use UPDATE statement\"); }","typeGuard":null,"tryCatchPattern":"try { rs.updateSQLXML(1, xml); } catch (final SQLFeatureNotSupportedException ex) { /* serialize and UPDATE */ }","preventionTips":["Write XML columns via UPDATE statements with string or SQLXML parameters.","Keep federation queries in the read path.","Test XML write paths against the proxy configuration actually used."],"tags":["jdbc","resultset","sql-federation","unsupported-operation","sqlxml"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}