{"record":{"id":"cbe2a9fc79c06aae","repo":"apache/beam","slug":"wrong-jdbc-type-expected-but-got-overriding-with-cbe2a9","errorCode":null,"errorMessage":"Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.","messagePattern":"Wrong JDBC type\\. Expected '(.+?)' but got '(.+?)'\\. Overriding with '(.+?)'\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/WriteToSqlServerSchemaTransformProvider.java","lineNumber":62,"sourceCode":"    return getUrn(ExternalTransforms.ManagedTransforms.Urns.SQL_SERVER_WRITE);\n  }\n\n  @Override\n  public String description() {\n    return inheritedDescription(\"SQL Server\", \"WriteToSqlServer\", \"sqlserver\", 1433);\n  }\n\n  @Override\n  protected String jdbcType() {\n    return MSSQL;\n  }\n\n  @Override\n  public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(\n      JdbcWriteSchemaTransformConfiguration configuration) {\n    String jdbcType = configuration.getJdbcType();\n    if (jdbcType != null && !jdbcType.isEmpty() && !jdbcType.equals(jdbcType())) {\n      LOG.warn(\n          \"Wrong JDBC type. Expected '{}' but got '{}'. Overriding with '{}'.\",\n          jdbcType(),\n          jdbcType,\n          jdbcType());\n      configuration = configuration.toBuilder().setJdbcType(jdbcType()).build();\n    }\n\n    List<@org.checkerframework.checker.nullness.qual.Nullable String> connectionInitSql =\n        configuration.getConnectionInitSql();\n    if (connectionInitSql != null && !connectionInitSql.isEmpty()) {\n      throw new IllegalArgumentException(\"SQL Server does not support connectionInitSql.\");\n    }\n\n    // Override \"connectionInitSql\" for sqlserver\n    configuration = configuration.toBuilder().setConnectionInitSql(Collections.emptyList()).build();\n    return new SqlServerWriteSchemaTransform(configuration);\n  }\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/WriteToSqlServerSchemaTransformProvider.java#L44-L80","documentation":"Warning logged by the SQL Server write SchemaTransform provider when the configuration's jdbcType differs from the provider's jdbcType(). The value is overridden with the provider's own type and the write proceeds against SQL Server. It indicates a misconfigured database type in the write path.","triggerScenarios":"Calling from() on WriteToSqlServerSchemaTransformProvider with a JdbcWriteSchemaTransformConfiguration whose jdbcType is non-null, non-empty, and unequal to jdbcType().","commonSituations":"Reusing a Postgres/MySQL write configuration for a SQL Server sink, or an expansion-service config carrying a stale jdbcType after switching databases.","solutions":["Remove jdbcType from the write configuration so the SQL Server default is used.","Set jdbcType to the SQL Server provider's jdbcType() value.","Use the matching provider class for the actual target database.","Confirm the JDBC URL (jdbc:sqlserver://...) matches SQL Server."],"exampleFix":"// before\nJdbcWriteSchemaTransformConfiguration cfg = JdbcWriteSchemaTransformConfiguration.builder()\n    .setJdbcType(\"oracle\")\n    .setUrl(\"jdbc:sqlserver://host;databaseName=db\")\n    .build();\n// after\nJdbcWriteSchemaTransformConfiguration cfg = JdbcWriteSchemaTransformConfiguration.builder()\n    .setUrl(\"jdbc:sqlserver://host;databaseName=db\")\n    .build();","handlingStrategy":"validation","validationCode":"if (config.getJdbcType() != null && !config.getJdbcType().isEmpty()\n    && !\"sqlserver\".equalsIgnoreCase(config.getJdbcType())) {\n  throw new IllegalArgumentException(\"jdbcType must match the SQL Server provider\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit jdbcType when using the SQL Server write provider.","Match provider class and JDBC URL to the same database.","Add a config smoke test that builds the transform and inspects the resolved configuration."],"tags":["jdbc","sqlserver","configuration","beam-io"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}