{"record":{"id":"381e82022833856c","repo":"apache/beam","slug":"jdbc-url-cannot-be-blank-jdbcwriteschematransformprovider","errorCode":null,"errorMessage":"JDBC URL cannot be blank","messagePattern":"JDBC URL cannot be blank","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcWriteSchemaTransformProvider.java","lineNumber":389,"sourceCode":"        \"Secret Manager to use for fetching secret values. Available options: 'GoogleCloudSecretManager', 'GoogleCloudHsmGeneratedSecretManager'. If not set, no secret manager is used and the password is treated as a plain password.\")\n    @Nullable\n    public abstract String getSecretManager();\n\n    @SchemaFieldDescription(\"Username for the JDBC source.\")\n    @Nullable\n    public abstract String getUsername();\n\n    @SchemaFieldDescription(\"SQL query used to insert records into the JDBC sink.\")\n    @Nullable\n    public abstract String getWriteStatement();\n\n    public void validate() {\n      validate(\"\");\n    }\n\n    public void validate(String jdbcType) throws IllegalArgumentException {\n      if (Strings.isNullOrEmpty(getJdbcUrl())) {\n        throw new IllegalArgumentException(\"JDBC URL cannot be blank\");\n      }\n\n      jdbcType = !Strings.isNullOrEmpty(jdbcType) ? jdbcType : getJdbcType();\n\n      boolean driverClassNamePresent = !Strings.isNullOrEmpty(getDriverClassName());\n      boolean driverJarsPresent = !Strings.isNullOrEmpty(getDriverJars());\n      boolean jdbcTypePresent = !Strings.isNullOrEmpty(jdbcType);\n      if (!driverClassNamePresent && !driverJarsPresent && !jdbcTypePresent) {\n        throw new IllegalArgumentException(\n            \"If JDBC type is not specified, then Driver Class Name and Driver Jars must be specified.\");\n      }\n      if (!driverClassNamePresent && !jdbcTypePresent) {\n        throw new IllegalArgumentException(\n            \"One of JDBC Driver class name or JDBC type must be specified.\");\n      }\n      if (jdbcTypePresent\n          && !JDBC_DRIVER_MAP.containsKey(Objects.requireNonNull(jdbcType).toLowerCase())) {\n        throw new IllegalArgumentException(","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcWriteSchemaTransformProvider.java#L371-L407","documentation":"Validation inside JdbcWriteSchemaTransformProvider's configuration that refuses to run a JDBC write when the jdbcUrl is null or empty (Guava Strings.isNullOrEmpty). A blank URL gives the driver nothing to connect to, so it fails fast with IllegalArgumentException.","triggerScenarios":"Calling validate() on JdbcWriteSchemaTransformConfiguration without setting jdbcUrl, or setting it to \"\"; building the config from external parameters where the URL key is missing or empty.","commonSituations":"Missing or misnamed config parameter in a YAML/CLI pipeline submission; environment variable not expanded; copy-pasted config where jdbcUrl line was omitted.","solutions":["Set jdbcUrl in the configuration, e.g. jdbc:postgresql://host:5432/db","Verify the config value actually resolves (log or print the built configuration before validate())","If reading from env/config file, check the variable is exported/non-empty at submit time"],"exampleFix":"// before\nJdbcWriteSchemaTransformProvider.Config cfg = builder().setDriverClassName(\"org.postgresql.Driver\").build();\n// after\nJdbcWriteSchemaTransformProvider.Config cfg = builder()\n    .setJdbcUrl(\"jdbc:postgresql://localhost:5432/mydb\")\n    .setDriverClassName(\"org.postgresql.Driver\").build();","handlingStrategy":"validation","validationCode":"import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Strings;\nif (Strings.isNullOrEmpty(cfg.getJdbcUrl())) {\n  throw new IllegalArgumentException(\"jdbcUrl must be set before validate()\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  config.validate();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().equals(\"JDBC URL cannot be blank\")) {\n    LOG.error(\"Set jdbcUrl in the schema-transform configuration\");\n  }\n  throw e;\n}","preventionTips":["Always set jdbcUrl first when building the configuration","If the URL comes from env/config, assert non-empty at pipeline-argument parsing time","Validate config immediately after building, before expansion"],"tags":["jdbc","beam","config","validation"],"backgroundTag":"empty-required-field","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"}