{"record":{"id":"1da8f07ebcc333e9","repo":"apache/shardingsphere","slug":"insertrow-1da8f0","errorCode":null,"errorMessage":"insertRow","messagePattern":"insertRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":95,"sourceCode":"    \n    @Override\n    public boolean absolute(final int row) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"absolute\");\n    }\n    \n    @Override\n    public boolean relative(final int rows) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"relative\");\n    }\n    \n    @Override\n    public int getRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRow\");\n    }\n    \n    @Override\n    public final void insertRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"insertRow\");\n    }\n    \n    @Override\n    public final void updateRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateRow\");\n    }\n    \n    @Override\n    public final void deleteRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"deleteRow\");\n    }\n    \n    @Override\n    public final void refreshRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"refreshRow\");\n    }\n    \n    @Override","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L77-L113","documentation":"insertRow() throws SQLFeatureNotSupportedException because the federation ResultSet is read-only: it exists to return the result of an already-executed federated query, not to act as an updatable JDBC cursor. The method is marked final in the abstract class, so subclasses cannot enable it either.","triggerScenarios":"Calling rs.insertRow() after moveToInsertRow()/updateXXX() on a ResultSet produced by a federation-routed statement — i.e. attempting row insertion through the JDBC updatable-ResultSet API against ShardingSphere federation.","commonSituations":"Visual table editors (JTable-bound JDBC editors, SQuirreL-style grid editing) that insert via the ResultSet API; legacy code written against drivers where CREATE STATEMENT RESULT_SET_UPDATABLE works; accidentally executing an INSERT..RETURNING-style or updatable SELECT through the federation path instead of a normal write statement.","solutions":["Perform inserts with a normal PreparedStatement INSERT executed outside federation (federation is for queries; DML goes through the regular sharding/traffic path)","If an ORM grid editor is involved, disable result-set editing for this datasource or configure the editor to generate INSERT statements","Verify the statement is not being classified as a federation query; hint or rewrite it so it executes as a standard sharded statement"],"exampleFix":"// before\nrs.moveToInsertRow();\nrs.updateString(1, \"val\");\nrs.insertRow();\n\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"INSERT INTO t (c) VALUES (?)\")) {\n    ps.setString(1, \"val\");\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {\n    // insertRow() will throw SQLFeatureNotSupportedException: use INSERT statements\n}","typeGuard":"private boolean isUpdatable(final ResultSet rs) throws SQLException {\n    return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n}","tryCatchPattern":"try {\n    rs.insertRow();\n} catch (final SQLFeatureNotSupportedException e) {\n    executeInsert(conn, rowValues); // statement-based fallback\n}","preventionTips":["Never use the insert-row cursor API on federation datasources","Always write via PreparedStatement INSERT","Mark federation connections read-only in grid editors"],"tags":["jdbc","resultset","sql-federation","updatable-cursor","insert","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}