MyCATApache/Mycat-Server · error · UnsupportedOperationException

global seq and share join and special…

Error message

global seq and share join and special io.mycat.backend.mysql.nio.handler.ResponseHandler  are not unsupported in jdbc driver yet 

What it means

JDBCConnection.query only supports execution when the response handler is a ConnectionHeartBeatHandler (heartbeat/keepalive probes). Any other ResponseHandler (i.e. real client query execution) throws UnsupportedOperationException because the JDBC backend driver integration does not implement global sequence, share-join, or the special NIO response handler protocol yet.

Solutions

  1. Use the native MySQL protocol backend (remove driver="jdbc" from the dataHost config) for normal queries.
  2. Move global-sequence and share-join logic off JDBC backends (e.g. server-side joins or local sequence config).
  3. Extend JDBCConnection.query to implement the handler protocol if you maintain a fork.
  4. Ensure heartbeats are the only callers of JDBCConnection.query while in JDBC mode.

Example fix

// before
// dataNode uses the jdbc driver and receives a client query
throw new UnsupportedOperationException("global seq and share join ... not unsupported in jdbc driver yet ");
// after
// schema.xml: use the native backend for query traffic
<dataNode name="dn1" dataHost="host1" database="db1" /> <!-- dataHost without driver="jdbc" -->
Defensive patterns

Strategy: try-catch

Validate before calling

boolean isHeartbeatOnly(BackendConnection con) {
    return con instanceof JDBCConnection
        && ((JDBCConnection) con).getRespHandler() instanceof ConnectionHeartBeatHandler;
}

Type guard

boolean supportsQuery(ResponseHandler h) { return h instanceof ConnectionHeartBeatHandler; }

Try / catch

try {
    conn.query(sql);
} catch (UnsupportedOperationException e) {
    if (e.getMessage() != null && e.getMessage().contains("not unsupported in jdbc driver")) {
        LOGGER.warn("JDBC backend only supports heartbeat queries; route this SQL to a native backend");
    } else { throw e; }
}

Prevention

When it happens

Trigger: Routing a normal user query to a JDBC-type dataNode whose JDBCConnection.query receives a non-heartbeat handler — e.g. using driver="jdbc" mode instead of the native NIO MySQL protocol, or using global sequence/share-join on a JDBC backend.

Common situations: Users configure a dataNode with driver="jdbc" and then run workloads requiring global sequence numbers or share-join, which are only implemented for the native MySQL backend.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at src/main/java/io/mycat/backend/jdbc/JDBCConnection.java:813

			}
			if (stmt != null) {
				try {
					stmt.close();
				} catch (SQLException e) {

				}
			}
		}
	}

	@Override
	public void query(final String sql) throws UnsupportedEncodingException {
		if(respHandler instanceof ConnectionHeartBeatHandler)
		{
			justForHeartbeat(sql);
		}    else
		{
			throw new UnsupportedOperationException("global seq and share join and special io.mycat.backend.mysql.nio.handler.ResponseHandler  are not unsupported in jdbc driver yet ");
		}
	}
	private void justForHeartbeat(String sql)
			  {

		Statement stmt = null;

		try {
			stmt = con.createStatement();
			stmt.execute(sql);
			if(!isAutocommit()){ //如果在写库上,如果是事务方式的连接,需要进行手动commit
			    con.commit();
			}
			this.respHandler.okResponse(OkPacket.OK, this);

		}
		catch (Exception e)
		{

View on GitHub (pinned to 65f8d8beb7)