{"record":{"id":"0fca4b2ee85637c1","repo":"MyCATApache/Mycat-Server","slug":"type-not-supported-yet","errorCode":null,"errorMessage":"type not supported yet","messagePattern":"type not supported yet","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/backend/jdbc/mongodb/MongoStatement.java","lineNumber":34,"sourceCode":"public class MongoStatement implements Statement\n{\n\tprivate MongoConnection _conn;\n    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","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/backend/jdbc/mongodb/MongoStatement.java#L16-L52","documentation":"The MongoStatement constructor validates the JDBC result-set type argument. The MongoDB backend only supports the default forward-only/read-only mode (type == ResultSet.TYPE_FORWARD_ONLY, i.e. 0); any other value (TYPE_SCROLL_INSENSITIVE = 1005, TYPE_SCROLL_SENSITIVE = 1004) throws UnsupportedOperationException('type not supported yet').","triggerScenarios":"Calling Connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability) or createStatement(type, concurrency) with resultSetType != ResultSet.TYPE_FORWARD_ONLY on a MongoDB connection in MyCat.","commonSituations":"Frameworks or connection pools that request scrollable result sets by default (some ORM/DAO templates, GUI query tools, code migrated from a MySQL JDBC driver usage that used TYPE_SCROLL_INSENSITIVE).","solutions":["Use Connection.createStatement() with no arguments, or pass ResultSet.TYPE_FORWARD_ONLY as the type.","Remove scrollable-result-set requests (last()/absolute()/previous() usage) and restructure code to iterate forward only.","If scrolling is required, buffer results in application memory after a forward-only fetch.","Patch MongoStatement to implement scrollable types if truly needed."],"exampleFix":"// before\nStatement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);\n\n// after\nStatement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);","handlingStrategy":"validation","validationCode":"if (resultSetType != ResultSet.TYPE_FORWARD_ONLY) {\n    throw new IllegalArgumentException(\"MongoDB backend supports only TYPE_FORWARD_ONLY\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    st = conn.createStatement(type, concur);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().startsWith(\"type not supported\")) {\n        st = conn.createStatement(); // fall back to default forward-only\n    } else {\n        throw e;\n    }\n}","preventionTips":["Always create statements with the no-arg createStatement() on MongoDB connections.","Avoid scrollable result-set APIs (last/absolute/previous) in code that may run against MongoDB.","Centralize statement creation in one helper that pins FORWARD_ONLY."],"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"}