{"record":{"id":"10ce88fe2b03f5df","repo":"MyCATApache/Mycat-Server","slug":"concurrency-not-supported-yet","errorCode":null,"errorMessage":"concurrency not supported yet","messagePattern":"concurrency not supported yet","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/backend/jdbc/mongodb/MongoStatement.java","lineNumber":37,"sourceCode":"    private final int _type;\n    private final int _concurrency;\n    private final int _holdability;\n    private int _fetchSize = 0;\n    //int _maxRows = 0;\n    private MongoResultSet _last;\n\n    public MongoStatement(MongoConnection conn, int type, int concurrency, int holdability)\n    {\n        this._conn = conn;\n        this._type = type;\n        this._concurrency = concurrency;\n        this._holdability = holdability;\n\n        if (this._type != 0) {\n\t\t\tthrow new UnsupportedOperationException(\"type not supported yet\");\n\t\t}\n        if (this._concurrency != 0) {\n\t\t\tthrow new UnsupportedOperationException(\"concurrency not supported yet\");\n\t\t}\n        if (this._holdability != 0) {\n\t\t\tthrow new UnsupportedOperationException(\"holdability not supported yet\");\n\t\t}\n    }\n\n\t@Override\n\tpublic <T> T unwrap(Class<T> iface) throws SQLException {\n\t\t\n\t\tthrow new UnsupportedOperationException();//return null;\n\t}\n\n\t@Override\n\tpublic boolean isWrapperFor(Class<?> iface) throws SQLException {\n\t\t\n\t\treturn false;\n\t}\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/backend/jdbc/mongodb/MongoStatement.java#L19-L55","documentation":"The MongoStatement constructor validates the JDBC result-set concurrency argument. Only CONCUR_READ_ONLY (0) is supported; passing CONCUR_UPDATABLE (1008) throws UnsupportedOperationException('concurrency not supported yet'), because MongoDB-backed statements cannot produce updatable result sets.","triggerScenarios":"Calling Connection.createStatement(resultSetType, ResultSet.CONCUR_UPDATABLE) or the three-argument variant with a concurrency value other than 0 on a MongoDB connection in MyCat.","commonSituations":"Code migrated from updatable-result-set-capable drivers (e.g. some MySQL configurations) that requests CONCUR_UPDATABLE; ORM/framework defaults enabling updatable result sets; query tools assuming updatable cursors.","solutions":["Pass ResultSet.CONCUR_READ_ONLY as the concurrency argument (or use the no-arg createStatement()).","Perform updates via explicit UPDATE statements (executeUpdate) instead of updatable result sets.","Refactor code that relies on updateXxx()/updateRow() cursor methods to issue standalone updates.","Patch MongoStatement to translate updatable cursors to MongoDB updates if the feature is required."],"exampleFix":"// before\nStatement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);\n\n// after\nStatement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);","handlingStrategy":"validation","validationCode":"if (concurrency != ResultSet.CONCUR_READ_ONLY) {\n    throw new IllegalArgumentException(\"MongoDB backend supports only CONCUR_READ_ONLY\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    st = conn.createStatement(type, concur);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().startsWith(\"concurrency not supported\")) {\n        st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Never request CONCUR_UPDATABLE on MongoDB-backed connections.","Express data modification as UPDATE statements, not updatable cursors.","Audit framework/ORM defaults for updatable result-set settings."],"tags":["jdbc","mongodb","resultset","unsupported-feature"],"backgroundTag":"unsupported-enum-value","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}