apache/beam · warning

Wrong JDBC type. Expected '{}' but got '{}'. Overriding with

Error message

Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.

What it means

Warning logged by the SQL Server read SchemaTransform provider when the configuration's jdbcType does not match the provider's jdbcType(). The value is overridden with the provider's own type and execution continues against SQL Server. It signals a mismatched database configuration.

Source

Thrown at sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromSqlServerSchemaTransformProvider.java:62

    return getUrn(ExternalTransforms.ManagedTransforms.Urns.SQL_SERVER_READ);
  }

  @Override
  public String description() {
    return inheritedDescription("SQL Server", "ReadFromSqlServer", "sqlserver", 1433);
  }

  @Override
  protected String jdbcType() {
    return MSSQL;
  }

  @Override
  public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(
      JdbcReadSchemaTransformConfiguration configuration) {
    String jdbcType = configuration.getJdbcType();
    if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) {
      LOG.warn(
          "Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.",
          jdbcType(),
          jdbcType,
          jdbcType());
      configuration = configuration.toBuilder().setJdbcType(jdbcType()).build();
    }

    List<@org.checkerframework.checker.nullness.qual.Nullable String> connectionInitSql =
        configuration.getConnectionInitSql();
    if (connectionInitSql != null && !connectionInitSql.isEmpty()) {
      throw new IllegalArgumentException("SQL Server does not support connectionInitSql.");
    }

    // Override "connectionInitSql" for sqlserver
    configuration = configuration.toBuilder().setConnectionInitSql(Collections.emptyList()).build();
    return new SqlServerReadSchemaTransform(configuration);
  }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Clear the jdbcType field from the configuration so the provider default applies.
  2. Set jdbcType to the SQL Server provider's jdbcType() value.
  3. Use the correct provider (e.g. ReadFromPostgresSchemaTransformProvider) if SQL Server is not the real target.
  4. Confirm the URL and driver in the configuration also match SQL Server.

Example fix

// before
JdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()
    .setJdbcType("postgres")
    .setUrl("jdbc:sqlserver://host;databaseName=db")
    .build();
// after
JdbcReadSchemaTransformConfiguration cfg = JdbcReadSchemaTransformConfiguration.builder()
    .setUrl("jdbc:sqlserver://host;databaseName=db")
    .build();
Defensive patterns

Strategy: validation

Validate before calling

if (config.getJdbcType() != null && !config.getJdbcType().isEmpty()
    && !"sqlserver".equalsIgnoreCase(config.getJdbcType())) {
  throw new IllegalArgumentException("jdbcType must match the SQL Server provider");
}

Prevention

When it happens

Trigger: Passing a JdbcReadSchemaTransformConfiguration with a non-empty jdbcType differing from the SQL Server provider's jdbcType() into ReadFromSqlServerSchemaTransformProvider.from().

Common situations: Reusing a config object created for Postgres or MySQL for a SQL Server read, or templating pipelines where jdbcType is set from a generic variable.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/337ba89163e9859b. Report an issue: GitHub.