{"record":{"id":"49be2059cd014ddb","repo":"apache/shardingsphere","slug":"movetoinsertrow","errorCode":null,"errorMessage":"moveToInsertRow","messagePattern":"moveToInsertRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java","lineNumber":120,"sourceCode":"    \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\n    public final void cancelRowUpdates() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"cancelRowUpdates\");\n    }\n    \n    @Override\n    public final void moveToInsertRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"moveToInsertRow\");\n    }\n    \n    @Override\n    public final void moveToCurrentRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"moveToCurrentRow\");\n    }\n    \n    @Override\n    public final boolean rowInserted() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowInserted\");\n    }\n    \n    @Override\n    public final boolean rowUpdated() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowUpdated\");\n    }\n    \n    @Override","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java#L102-L138","documentation":"moveToInsertRow() is final in AbstractUnsupportedOperationResultSet and always throws SQLFeatureNotSupportedException. The insert-row staging area only exists on CONCUR_UPDATABLE cursors, which the sharding ResultSet deliberately does not implement.","triggerScenarios":"Calling ResultSet.moveToInsertRow() followed by updateXxx/insertRow to insert via cursor — a pattern used by some ORM internals, RAD tools, and legacy codebases — on a ResultSet from ShardingSphereDataSource.","commonSituations":"Older VisualBasic/JDBC-style 'AddNew' insert flows ported to Java; form builders and low-code platforms that insert via the insert row; migration from MySQL Connector/J with updatable result sets to the sharding driver.","solutions":["Insert with an explicit INSERT statement via PreparedStatement; ShardingSphere will shard it correctly.","Configure the tool/ORM to use statement-based inserts instead of cursor-based inserts.","For non-sharded single tables, use the physical datasource connection where cursor inserts work if the backend driver supports them."],"exampleFix":"// before\nrs.moveToInsertRow(); // throws\nrs.updateString(1, \"v\");\nrs.insertRow();\n\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"INSERT INTO t (col) VALUES (?)\")) {\n    ps.setString(1, \"v\");\n    ps.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {\n    // insert via INSERT SQL; cursor insert-row is unavailable\n}","typeGuard":null,"tryCatchPattern":"try {\n    rs.moveToInsertRow();\n} catch (SQLFeatureNotSupportedException e) {\n    executeInsert(row); // PreparedStatement INSERT\n}","preventionTips":["Use INSERT statements for all creates.","Disable RAD-tool/low-code cursor-insert modes.","Search the codebase for moveToInsertRow before adopting the sharding driver."],"tags":["jdbc","resultset","row-updates","shardingsphere","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}