apache/seatunnel · error · SeaTunnelException
Failed to querySQLResult
Error message
Failed to querySQLResult
What it means
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.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/xugu/XuguCatalog.java:170
// Rewrite the databaseExists method, and xugu will force the conversion to uppercase
@Override
public boolean databaseExists(String databaseName) throws CatalogException {
if (StringUtils.isBlank(databaseName)) {
return false;
}
try {
return querySQLResultExists(
defaultUrl, getDatabaseWithConditionSql(databaseName.toUpperCase()));
} catch (SeaTunnelRuntimeException e) {
if (e.getSeaTunnelErrorCode().getCode().equals(UNSUPPORTED_METHOD.getCode())) {
log.warn(
"The catalog: {} is not supported the getDatabaseWithConditionSql for databaseExists",
this.catalogName);
return listDatabases().contains(databaseName.toUpperCase());
}
throw e;
} catch (SQLException e) {
throw new SeaTunnelException("Failed to querySQLResult", e);
}
}
@Override
protected String getCreateTableSql(
TablePath tablePath, CatalogTable table, boolean createIndex) {
return new XuguCreateTableSqlBuilder(table, createIndex).build(tablePath);
}
@Override
protected String getDropTableSql(TablePath tablePath) {
return String.format("DROP TABLE %s", tablePath.getSchemaAndTableName("\""));
}
@Override
protected String getCreateDatabaseSql(String databaseName) {
return String.format("CREATE DATABASE \"%s\"", databaseName);
}View on GitHub (pinned to cf67b549a7)
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.
Example fix
// before
boolean exists = catalog.databaseExists("mydb"); // throws SeaTunnelException on SQL failure
// after
try {
boolean exists = catalog.databaseExists("MYDB");
} catch (SeaTunnelException e) {
LOG.error("XuGu probe failed", e.getCause()); // inspect cause for real reason
throw e;
} Defensive patterns
Strategy: try-catch
Try / catch
// java
try {
boolean exists = catalog.databaseExists(dbName);
} catch (SeaTunnelException e) {
Throwable root = e.getCause();
LOG.error("XuGu databaseExists probe failed: {}", root.getMessage());
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Failed executeSql error %s
- Failed dropping table %s
- Failed creating database %s in catalog %s
- Failed dropping database %s in catalog %s
- Failed truncate table %s in catalog %s
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/9acd706fa5897ffc.
Report an issue: GitHub.