apache/dolphinscheduler · error · ServiceException

GET_DATASOURCE_TABLES_ERROR

GET_DATASOURCE_TABLES_ERROR

Error message

Status.GET_DATASOURCE_TABLES_ERROR

What it means

getTables throws GET_DATASOURCE_TABLES_ERROR when connection.getMetaData().getConnection().getSchema() raises SQLException while resolving the schema for the datasource. The connection was established but schema introspection failed.

Solutions

  1. Upgrade the JDBC driver for the datasource type to one that supports getSchema()
  2. Connect with a user that has a default/current schema set
  3. Check the logged exception (datasourceId) to identify the underlying SQLException
  4. If the driver can't support it, avoid the table-browser endpoint for this datasource type
Defensive patterns

Strategy: try-catch

Validate before calling

try (Connection c = DriverManager.getConnection(url, user, pass)) {
    c.getSchema(); // fail fast if driver cannot resolve schema
}

Try / catch

try {
    return dataSourceService.getTables(loginUser, datasourceId, database);
} catch (ServiceException e) {
    if (Status.GET_DATASOURCE_TABLES_ERROR.getCode() == e.getCode()) { /* check driver getSchema support */ }
    throw e;
}

Prevention

When it happens

Trigger: During getTables, metaData.getConnection().getSchema() throws SQLException — e.g. drivers that do not implement getSchema, DB2/Oracle quirks with current schema, or session/state errors on the freshly opened connection.

Common situations: Datasource types whose JDBC drivers throw on getSchema(); databases where the connected user has no default schema; driver version incompatibilities with the JDK's schema API.

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


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/cb4759e95aaef6e4. Report an issue: GitHub.

Appendix: source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/DataSourceServiceImpl.java:389

        }

        Connection connection =
                DataSourceUtils.getConnection(dataSource.getType(), connectionParam);
        ResultSet tables = null;

        try {

            if (null == connection) {
                throw new ServiceException(Status.DATASOURCE_CONNECT_FAILED);
            }

            DatabaseMetaData metaData = connection.getMetaData();
            String schema = null;
            try {
                schema = metaData.getConnection().getSchema();
            } catch (SQLException e) {
                log.error("Can not get the schema, datasourceId:{}.", datasourceId, e);
                throw new ServiceException(Status.GET_DATASOURCE_TABLES_ERROR);
            }

            tables = metaData.getTables(
                    database,
                    getDbSchemaPattern(dataSource.getType(), schema, connectionParam),
                    "%", TABLE_TYPES);
            if (null == tables) {
                log.error("Get datasource tables error, datasourceId:{}.", datasourceId);
                throw new ServiceException(Status.GET_DATASOURCE_TABLES_ERROR);
            }

            tableList = new ArrayList<>();
            while (tables.next()) {
                String name = tables.getString(TABLE_NAME);
                tableList.add(name);
            }

        } catch (Exception e) {

View on GitHub (pinned to 02eac45a1b)