MyCATApache/Mycat-Server · error · UnsupportedOperationException
type not supported yet
Error message
type not supported yet
What it means
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').
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.
Example fix
// before Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); // after Statement st = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
Defensive patterns
Strategy: validation
Validate before calling
if (resultSetType != ResultSet.TYPE_FORWARD_ONLY) {
throw new IllegalArgumentException("MongoDB backend supports only TYPE_FORWARD_ONLY");
} Try / catch
try {
st = conn.createStatement(type, concur);
} catch (UnsupportedOperationException e) {
if (e.getMessage().startsWith("type not supported")) {
st = conn.createStatement(); // fall back to default forward-only
} else {
throw e;
}
} Prevention
- 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.
When it happens
Trigger: Calling Connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability) or createStatement(type, concurrency) with resultSetType != ResultSet.TYPE_FORWARD_ONLY on a MongoDB connection in MyCat.
Common situations: 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).
Related errors
- concurrency not supported yet
- CallableStatement not supported
- Unexpected exception
- holdability not supported yet
- batch not supported
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/0fca4b2ee85637c1.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/backend/jdbc/mongodb/MongoStatement.java:34
public class MongoStatement implements Statement
{
private MongoConnection _conn;
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 {
View on GitHub (pinned to 65f8d8beb7)