{"record":{"id":"1e87e6708b9d5bf7","repo":"apache/seatunnel","slug":"failed-to-querysqlresult-1e87e6","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/iris/IrisCatalog.java","lineNumber":149,"sourceCode":"\n    @Override\n    protected String getOptionTableName(TablePath tablePath) {\n        return tablePath.getSchemaAndTableName();\n    }\n\n    @Override\n    public boolean databaseExists(String databaseName) throws CatalogException {\n        throw new SeaTunnelException(\"Not supported for list databases for iris\");\n    }\n\n    @Override\n    public boolean tableExists(TablePath tablePath) throws CatalogException {\n        try {\n            return querySQLResultExists(\n                    this.getUrlFromDatabaseName(tablePath.getDatabaseName()),\n                    getTableWithConditionSql(tablePath));\n        } catch (SQLException e) {\n            throw new SeaTunnelException(\"Failed to querySQLResult\", e);\n        }\n    }\n\n    @Override\n    protected String getTableWithConditionSql(TablePath tablePath) {\n        return String.format(\n                getListTableSql(tablePath.getSchemaName()) + \" and TABLE_NAME = '%s'\",\n                tablePath.getTableName());\n    }\n\n    @Override\n    protected String getUrlFromDatabaseName(String databaseName) {\n        return defaultUrl;\n    }\n\n    @Override\n    public List<String> listTables(String schemaName)\n            throws CatalogException, DatabaseNotExistException {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/iris/IrisCatalog.java#L131-L167","documentation":"IrisCatalog.tableExists wraps any SQLException from executing the table-existence query into a generic SeaTunnelException(\"Failed to querySQLResult\"). The actual SQL error (bad URL, syntax error, connection failure) is the chained cause, so this message alone is uninformative.","triggerScenarios":"Calling tableExists (directly or via getTable/createTable, which pre-check existence) when querySQLResultExists throws SQLException: connection to the IRIS database fails, the existence-check SQL is invalid for the target IRIS version, or the database URL derived from the database name is wrong.","commonSituations":"IRIS instance down or unreachable; wrong credentials in catalog config; IRIS SQL dialect differences making the generated condition SQL fail; database name mapping to an invalid JDBC URL.","solutions":["Inspect the chained cause for the real SQLException","Test connectivity to the IRIS instance with a standalone JDBC client using the same URL/credentials","Verify the database name used in TablePath maps to a valid IRIS namespace/URL via getUrlFromDatabaseName","Log/print the SQL produced by getTableWithConditionSql and run it manually in the IRIS terminal","Add retry logic for transient network failures before re-running"],"exampleFix":"// before\nboolean exists = catalog.tableExists(tablePath); // opaque SeaTunnelException\n// after\ntry {\n    boolean exists = catalog.tableExists(tablePath);\n} catch (SeaTunnelException e) {\n    LOG.error(\"tableExists failed: {}\", e.getCause(), e);\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"// verify connectivity first\ntry (Connection c = DriverManager.getConnection(jdbcUrl, user, pass)) {\n    if (!c.isValid(5)) throw new IllegalStateException(\"IRIS connection invalid\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    boolean exists = catalog.tableExists(tablePath);\n} catch (SeaTunnelException e) {\n    LOG.error(\"IRIS tableExists failed for {}: {}\", tablePath, e.getCause(), e);\n    throw e;\n}","preventionTips":["Always inspect getCause() — the message is generic by design","Pre-validate IRIS connectivity before catalog operations","Keep database names in TablePath consistent with IRIS namespace naming","Test the generated existence SQL per IRIS version"],"tags":["jdbc","iris","sql","catalog"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}