MyCATApache/Mycat-Server · error · UnsupportedOperationException

concurrency not supported yet

Error message

concurrency not supported yet

What it means

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.

Solutions

  1. Pass ResultSet.CONCUR_READ_ONLY as the concurrency argument (or use the no-arg createStatement()).
  2. Perform updates via explicit UPDATE statements (executeUpdate) instead of updatable result sets.
  3. Refactor code that relies on updateXxx()/updateRow() cursor methods to issue standalone updates.
  4. Patch MongoStatement to translate updatable cursors to MongoDB updates if the feature is required.

Example fix

// before
Statement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);

// after
Statement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
Defensive patterns

Strategy: validation

Validate before calling

if (concurrency != ResultSet.CONCUR_READ_ONLY) {
    throw new IllegalArgumentException("MongoDB backend supports only CONCUR_READ_ONLY");
}

Try / catch

try {
    st = conn.createStatement(type, concur);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().startsWith("concurrency not supported")) {
        st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/10ce88fe2b03f5df. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/backend/jdbc/mongodb/MongoStatement.java:37

    private final int _type;
    private final int _concurrency;
    private final int _holdability;
    private int _fetchSize = 0;
    //int _maxRows = 0;
    private MongoResultSet _last;

    public MongoStatement(MongoConnection conn, int type, int concurrency, int holdability)
    {
        this._conn = conn;
        this._type = type;
        this._concurrency = concurrency;
        this._holdability = holdability;

        if (this._type != 0) {
			throw new UnsupportedOperationException("type not supported yet");
		}
        if (this._concurrency != 0) {
			throw new UnsupportedOperationException("concurrency not supported yet");
		}
        if (this._holdability != 0) {
			throw new UnsupportedOperationException("holdability not supported yet");
		}
    }

	@Override
	public <T> T unwrap(Class<T> iface) throws SQLException {
		
		throw new UnsupportedOperationException();//return null;
	}

	@Override
	public boolean isWrapperFor(Class<?> iface) throws SQLException {
		
		return false;
	}

View on GitHub (pinned to 65f8d8beb7)