{"record":{"id":"9acd706fa5897ffc","repo":"apache/seatunnel","slug":"failed-to-querysqlresult-9acd70","errorCode":null,"errorMessage":"Failed to querySQLResult","messagePattern":"Failed to querySQLResult","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/xugu/XuguCatalog.java","lineNumber":170,"sourceCode":"    // Rewrite the databaseExists method, and xugu will force the conversion to uppercase\n    @Override\n    public boolean databaseExists(String databaseName) throws CatalogException {\n        if (StringUtils.isBlank(databaseName)) {\n            return false;\n        }\n        try {\n            return querySQLResultExists(\n                    defaultUrl, getDatabaseWithConditionSql(databaseName.toUpperCase()));\n        } catch (SeaTunnelRuntimeException e) {\n            if (e.getSeaTunnelErrorCode().getCode().equals(UNSUPPORTED_METHOD.getCode())) {\n                log.warn(\n                        \"The catalog: {} is not supported the getDatabaseWithConditionSql for databaseExists\",\n                        this.catalogName);\n                return listDatabases().contains(databaseName.toUpperCase());\n            }\n            throw e;\n        } catch (SQLException e) {\n            throw new SeaTunnelException(\"Failed to querySQLResult\", e);\n        }\n    }\n\n    @Override\n    protected String getCreateTableSql(\n            TablePath tablePath, CatalogTable table, boolean createIndex) {\n        return new XuguCreateTableSqlBuilder(table, createIndex).build(tablePath);\n    }\n\n    @Override\n    protected String getDropTableSql(TablePath tablePath) {\n        return String.format(\"DROP TABLE %s\", tablePath.getSchemaAndTableName(\"\\\"\"));\n    }\n\n    @Override\n    protected String getCreateDatabaseSql(String databaseName) {\n        return String.format(\"CREATE DATABASE \\\"%s\\\"\", databaseName);\n    }","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/xugu/XuguCatalog.java#L152-L188","documentation":"XuguCatalog.databaseExists() executes a probe query to test whether a database exists; any SQLException from that query is wrapped in a SeaTunnelException with the message 'Failed to querySQLResult'. The specific SQLValidationException-like case where the catalog does not support getDatabaseWithConditionSql is handled by falling back to listDatabases(), so this exception represents a real query failure (connectivity, credentials, or SQL error), not a missing database.","triggerScenarios":"Calling XuguCatalog.databaseExists(databaseName) when the JDBC connection to XuGu fails mid-query, credentials are wrong, the server is unreachable, or the generated condition SQL is rejected by the XuGu server.","commonSituations":"XuGu instance down or firewalled; wrong username/password/port in catalog config; XuGu SQL dialect incompatibility in the generated database-existence SQL; connection pool exhausted.","solutions":["Read the wrapped SQLException cause for the root failure (auth, connect, syntax).","Confirm XuGu server reachability (host/port, firewall) and valid credentials in the catalog configuration.","Run the equivalent database-existence query manually against XuGu with the same user.","If the probe SQL is dialect-invalid, rely on the fallback path or update getDatabaseWithConditionSql for XuGu syntax."],"exampleFix":"// before\nboolean exists = catalog.databaseExists(\"mydb\"); // throws SeaTunnelException on SQL failure\n// after\ntry {\n    boolean exists = catalog.databaseExists(\"MYDB\");\n} catch (SeaTunnelException e) {\n    LOG.error(\"XuGu probe failed\", e.getCause()); // inspect cause for real reason\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// java\ntry {\n    boolean exists = catalog.databaseExists(dbName);\n} catch (SeaTunnelException e) {\n    Throwable root = e.getCause();\n    LOG.error(\"XuGu databaseExists probe failed: {}\", root.getMessage());\n    throw e;\n}","preventionTips":["Verify XuGu server reachability and credentials before catalog operations.","Test the generated database-existence SQL against the XuGu version in use.","Use the listDatabases fallback when the probe SQL is not supported."],"tags":["xugu","jdbc","catalog","sql"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}