diff --git a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java index 5076f4a10298..77ec4082f6f4 100644 --- a/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java +++ b/sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcSchemaIOProvider.java @@ -175,9 +175,11 @@ protected JdbcIO.DataSourceConfiguration getDataSourceConfiguration() { dataSourceConfiguration = dataSourceConfiguration.withConnectionInitSqls(initSqls); } - @Nullable Integer maxConnections = config.getInt32("maxConnections"); - if (maxConnections != null) { - dataSourceConfiguration = dataSourceConfiguration.withMaxConnections(maxConnections); + if (config.getSchema().hasField("maxConnections")) { + @Nullable Integer maxConnections = config.getInt32("maxConnections"); + if (maxConnections != null) { + dataSourceConfiguration = dataSourceConfiguration.withMaxConnections(maxConnections); + } } return dataSourceConfiguration;