{"record":{"id":"21aab25a3479a8d2","repo":"apache/shardingsphere","slug":"insertrow","errorCode":null,"errorMessage":"insertRow","messagePattern":"insertRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java","lineNumber":95,"sourceCode":"    \n    @Override\n    public final boolean absolute(final int row) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"absolute\");\n    }\n    \n    @Override\n    public final boolean relative(final int rows) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"relative\");\n    }\n    \n    @Override\n    public final 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/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java#L77-L113","documentation":"insertRow() belongs to the JDBC updatable-result-set API: it inserts the insert-row buffer into the table. ShardingSphere result sets are read-only, forward-only merge streams, so insertRow() is final and throws SQLFeatureNotSupportedException; writes must go through proper INSERT statements so they can be parsed, rewritten, and routed to shards.","triggerScenarios":"Calling rs.moveToInsertRow(); rs.updateString(...); rs.insertRow(); on a ResultSet produced by a ShardingSphere-driver query — the updatable-result-set editing pattern.","commonSituations":"Swing/SWT table editors and generic CRUD frameworks that edit via updatable result sets; code ported from drivers where CONCUR_UPDATABLE is supported; attempts to avoid writing INSERT SQL.","solutions":["Replace result-set editing with an explicit INSERT via PreparedStatement.executeUpdate(); ShardingSphere will route it correctly.","Remove CONCUR_UPDATABLE hints — they give no capability here and mislead maintainers.","For batch inserts, use addBatch()/executeBatch() on the PreparedStatement.","If a UI component requires updatable result sets, isolate that component on a direct, non-sharded DataSource."],"exampleFix":"// before\nrs.moveToInsertRow();\nrs.updateString(2, \"PAID\");\nrs.insertRow(); // throws\n\n// after\nPreparedStatement ps = conn.prepareStatement(\"INSERT INTO t_order(status) VALUES (?)\");\nps.setString(1, \"PAID\");\nps.executeUpdate();","handlingStrategy":"validation","validationCode":"int concurrency = rs.getConcurrency();\nif (concurrency == ResultSet.CONCUR_READ_ONLY) {\n    // insertRow()/updateRow() unavailable: issue INSERT/UPDATE statements instead\n}","typeGuard":null,"tryCatchPattern":"try {\n    rs.insertRow();\n} catch (SQLFeatureNotSupportedException e) {\n    try (PreparedStatement ps = conn.prepareStatement(\"INSERT INTO t(...) VALUES (?,?)\")) {\n        bind(ps); ps.executeUpdate();\n    }\n}","preventionTips":["Treat sharded result sets as strictly read-only; write through INSERT/UPDATE/DELETE statements so routing works.","Do not request CONCUR_UPDATABLE — it silently changes nothing here.","Route editable UI tables to a direct datasource or convert them to statement-based persistence."],"tags":["jdbc","resultset","updatable-resultset","insert","read-only"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}