{"record":{"id":"b9cd4f9a7c52ea43","repo":"apache/beam","slug":"wrong-jdbc-type-expected-but-got-overriding-with","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":"info","filePath":"sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromMySqlSchemaTransformProvider.java","lineNumber":60,"sourceCode":"    return getUrn(ExternalTransforms.ManagedTransforms.Urns.MYSQL_READ);\n  }\n\n  @Override\n  public String description() {\n    return inheritedDescription(\"MySQL\", \"ReadFromMySql\", \"mysql\", 3306);\n  }\n\n  @Override\n  protected String jdbcType() {\n    return MYSQL;\n  }\n\n  @Override\n  public @UnknownKeyFor @NonNull @Initialized SchemaTransform from(\n      JdbcReadSchemaTransformConfiguration 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    Integer fetchSize = configuration.getFetchSize();\n    if (fetchSize != null\n        && fetchSize > 0\n        && configuration.getJdbcUrl() != null\n        && !configuration.getJdbcUrl().contains(\"useCursorFetch=true\")) {\n      throw new IllegalArgumentException(\n          \"It is required to set useCursorFetch=true\"\n              + \" in the JDBC URL when using fetchSize for MySQL\");\n    }\n    return new MySqlReadSchemaTransform(configuration);\n  }","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/providers/ReadFromMySqlSchemaTransformProvider.java#L42-L78","documentation":"In ReadFromMySqlSchemaTransformProvider.from, the JDBC type supplied in the configuration does not match the provider's own dialect (mysql). The provider logs a warning and silently overrides the configured jdbcType with its own value instead of failing.","triggerScenarios":"Constructing a JdbcReadSchemaTransformConfiguration with a non-empty jdbcType that is not 'mysql' (e.g., 'postgresql') and passing it to the MySQL schema transform provider.","commonSituations":"Users building pipeline YAML/config that sets jdbcType once and reuses it across database providers, or typo'd jdbcType values; common when switching a pipeline between MySQL and Postgres providers.","solutions":["Remove the jdbcType field from the configuration and let the provider set its own dialect","Set jdbcType to 'mysql' when using the MySQL provider (use ReadFromPostgresSchemaTransformProvider for Postgres)","Route the configuration to the correct provider matching the configured jdbcType"],"exampleFix":"// before\nconfiguration = JdbcReadSchemaTransformConfiguration.builder()\n  .setJdbcType(\"postgres\")\n  .setUrl(url).build();\n// after\nconfiguration = JdbcReadSchemaTransformConfiguration.builder()\n  .setJdbcType(\"mysql\") // or omit; provider overrides anyway\n  .setUrl(url).build();","handlingStrategy":"validation","validationCode":"// before building the configuration\nif (jdbcType != null && !jdbcType.isEmpty() && !\"mysql\".equals(jdbcType)) {\n  throw new IllegalArgumentException(\"ReadFromMySql requires jdbcType=mysql, got: \" + jdbcType);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match jdbcType to the provider (mysql -> ReadFromMySql, postgresql -> ReadFromPostgres)","Omit jdbcType and let the provider set its own dialect","Parameterize pipeline YAML per database rather than sharing a jdbcType field across providers"],"tags":["jdbc","mysql","beam","schema-transform","config"],"backgroundTag":"invalid-enum-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"}