{"record":{"id":"61794b48f23ce722","repo":"MyCATApache/Mycat-Server","slug":"global-seq-and-share-join-and-special-io-mycat-bac","errorCode":null,"errorMessage":"global seq and share join and special io.mycat.backend.mysql.nio.handler.ResponseHandler  are not unsupported in jdbc driver yet ","messagePattern":"global seq and share join and special io\\.mycat\\.backend\\.mysql\\.nio\\.handler\\.ResponseHandler  are not unsupported in jdbc driver yet ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/backend/jdbc/JDBCConnection.java","lineNumber":813,"sourceCode":"\t\t\t}\n\t\t\tif (stmt != null) {\n\t\t\t\ttry {\n\t\t\t\t\tstmt.close();\n\t\t\t\t} catch (SQLException e) {\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic void query(final String sql) throws UnsupportedEncodingException {\n\t\tif(respHandler instanceof ConnectionHeartBeatHandler)\n\t\t{\n\t\t\tjustForHeartbeat(sql);\n\t\t}    else\n\t\t{\n\t\t\tthrow new UnsupportedOperationException(\"global seq and share join and special io.mycat.backend.mysql.nio.handler.ResponseHandler  are not unsupported in jdbc driver yet \");\n\t\t}\n\t}\n\tprivate void justForHeartbeat(String sql)\n\t\t\t  {\n\n\t\tStatement stmt = null;\n\n\t\ttry {\n\t\t\tstmt = con.createStatement();\n\t\t\tstmt.execute(sql);\n\t\t\tif(!isAutocommit()){ //如果在写库上，如果是事务方式的连接，需要进行手动commit\n\t\t\t    con.commit();\n\t\t\t}\n\t\t\tthis.respHandler.okResponse(OkPacket.OK, this);\n\n\t\t}\n\t\tcatch (Exception e)\n\t\t{","sourceCodeStart":795,"sourceCodeEnd":831,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/backend/jdbc/JDBCConnection.java#L795-L831","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the native MySQL protocol backend (remove driver=\"jdbc\" from the dataHost config) for normal queries.","Move global-sequence and share-join logic off JDBC backends (e.g. server-side joins or local sequence config).","Extend JDBCConnection.query to implement the handler protocol if you maintain a fork.","Ensure heartbeats are the only callers of JDBCConnection.query while in JDBC mode."],"exampleFix":"// before\n// dataNode uses the jdbc driver and receives a client query\nthrow new UnsupportedOperationException(\"global seq and share join ... not unsupported in jdbc driver yet \");\n// after\n// schema.xml: use the native backend for query traffic\n<dataNode name=\"dn1\" dataHost=\"host1\" database=\"db1\" /> <!-- dataHost without driver=\"jdbc\" -->","handlingStrategy":"try-catch","validationCode":"boolean isHeartbeatOnly(BackendConnection con) {\n    return con instanceof JDBCConnection\n        && ((JDBCConnection) con).getRespHandler() instanceof ConnectionHeartBeatHandler;\n}","typeGuard":"boolean supportsQuery(ResponseHandler h) { return h instanceof ConnectionHeartBeatHandler; }","tryCatchPattern":"try {\n    conn.query(sql);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not unsupported in jdbc driver\")) {\n        LOGGER.warn(\"JDBC backend only supports heartbeat queries; route this SQL to a native backend\");\n    } else { throw e; }\n}","preventionTips":["Only route heartbeat/probe SQL to JDBC-type dataNodes; route client queries to native MySQL backends.","Avoid global-sequence and share-join features on JDBC backends.","Document jdbc-driver limitations in team config guidelines.","If JDBC mode is required, implement the ResponseHandler protocol in a fork before enabling workloads."],"tags":["jdbc","unsupported-operation","limitation","mysql"],"backgroundTag":"unsupported-operation","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"}