{"record":{"id":"bef4986025fe9435","repo":"MyCATApache/Mycat-Server","slug":"not-found-schema","errorCode":null,"errorMessage":"not found schema : ","messagePattern":"not found schema : ","errorType":"exception","errorClass":"SQLSyntaxErrorException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/impl/DruidMycatRouteStrategy.java","lineNumber":624,"sourceCode":"\t\t}\n\t}\n\n\t/**\n\t * 分析 SHOW SQL\n\t */\n\t@Override\n\tpublic RouteResultset analyseShowSQL(SchemaConfig schema,\n\t\t\tRouteResultset rrs, String stmt) throws SQLSyntaxErrorException {\n\n\t\tString[] fields = SchemaUtil.parseShowTable(stmt);\n        if (\"1\".equals(fields[0])) {// show tables\n\t\t\tString relSchema = fields[3];\n\t\t\tString tableName = fields[8];\n            //\n            if (relSchema != null && !relSchema.equalsIgnoreCase(schema.getName())) {\n                schema = MycatServer.getInstance().getConfig().getSchemas().get(relSchema);\n                if (schema == null) {\n                    throw new SQLSyntaxErrorException(\"not found schema : \" + relSchema);\n                }\n            }\n\t\t\t// 2020/03/19 Ken.Li\n\t\t\t// if (StringUtils.isNotBlank(tableName) && tableName.indexOf(\"%\") < 0) {\n\t\t\tif (StringUtils.isNotBlank(tableName) && tableName.indexOf(\"%\") < 0 && !schema.getTables().isEmpty()) {\n                TableConfig tableConfig = schema.getTables().get(tableName.toUpperCase());\n                if (tableConfig != null) {\n                    String dataNode = RouterUtil.getAliveRandomDataNode(tableConfig);\n                    PhysicalDBNode dataNodeObj = MycatServer.getInstance().getConfig().getDataNodes().get(dataNode);\n                    if (StringUtils.isNotBlank(dataNodeObj.getDatabase())) {\n                        stmt = stmt.replaceAll(relSchema, dataNodeObj.getDatabase());\n                    }\n                    return RouterUtil.routeToSingleNode(rrs, dataNode, stmt);\n                }\n            }\n            // remove db\n            if (StringUtils.isNotBlank(relSchema)) {\n\t\t\t\tif(schema.getDataNode() !=null) {","sourceCodeStart":606,"sourceCodeEnd":642,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/impl/DruidMycatRouteStrategy.java#L606-L642","documentation":"While analysing a SHOW statement (analyseShowSQL, e.g. SHOW FULL COLUMNS from an information_schema query), Mycat extracts the related schema name from the SQL fields and looks it up in the server's schema config; if that schema is not defined in Mycat's configuration, it throws 'not found schema : <name>'.","triggerScenarios":"Running SHOW statements (e.g. from clients or GUI tools like MySQL Workbench/Navicat) whose query references a schema/database name absent from Mycat's schema.xml, or where the client sends a relation schema different from the current one.","commonSituations":"GUI tools enumerating all databases including ones not declared in schema.xml; clients connected to a database name that was never configured; typos or case mismatches in schema names; schemas dropped from config while clients still reference them.","solutions":["Add the missing schema to schema.xml (with at least one table/datanode) and restart/reload Mycat config.","Connect the client to a schema name that is defined in Mycat's configuration.","Fix case/typo mismatches between the SQL's schema reference and the configured schema name.","Filter or configure the client tool to only introspect configured schemas."],"exampleFix":"// before (schema.xml)\n<schema name=\"db1\" ...>...</schema>\n// after (add the schema the client references)\n<schema name=\"db2\" dataNode=\"dn1\">...</schema>","handlingStrategy":"try-catch","validationCode":"// check the referenced schema exists in Mycat config before sending SHOW\nSchemaConfig sc = MycatServer.getInstance().getConfig().getSchemas().get(relSchema);\nif (sc == null) throw new IllegalArgumentException(\"Schema not configured in Mycat: \" + relSchema);","typeGuard":null,"tryCatchPattern":"try { rrs = routeSystemInfo(showSql, sqlType, sc, ...); } catch (SQLSyntaxErrorException e) {\n    if (e.getMessage().startsWith(\"not found schema : \")) {\n        String missing = e.getMessage().substring(\"not found schema : \".length());\n        log.warn(\"Client referenced unconfigured schema {}\", missing);\n    } else throw e;\n}","preventionTips":["Declare every schema clients may reference in schema.xml.","Match database-name case exactly between clients and config.","Restrict GUI/introspection tools to configured schemas.","Reload Mycat config after schema additions before clients connect."],"tags":["schema","configuration","show"],"backgroundTag":"resource-not-found","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}