Package org.apache.beam.sdk.io.jdbc
Class JdbcIO.DataSourceConfiguration
java.lang.Object
org.apache.beam.sdk.io.jdbc.JdbcIO.DataSourceConfiguration
- All Implemented Interfaces:
Serializable
- Enclosing class:
JdbcIO
A POJO describing a
DataSource
, either providing directly a DataSource
or all
properties allowing to create a DataSource
.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate
(DataSource dataSource) create
(ValueProvider<@Nullable String> driverClassName, ValueProvider<@Nullable String> url) withConnectionInitSqls
(Collection<@Nullable String> connectionInitSqls) Sets the connection init sql statements to driver.connect(...).withConnectionInitSqls
(ValueProvider<Collection<@Nullable String>> connectionInitSqls) Same aswithConnectionInitSqls(Collection)
but accepting a ValueProvider.withConnectionProperties
(String connectionProperties) Sets the connection properties passed to driver.connect(...).withConnectionProperties
(ValueProvider<@Nullable String> connectionProperties) Same aswithConnectionProperties(String)
but accepting a ValueProvider.withDriverClassLoader
(ClassLoader driverClassLoader) Sets the class loader instance to be used to load the JDBC driver.withDriverJars
(String driverJars) Comma separated paths for JDBC drivers.withDriverJars
(ValueProvider<String> driverJars) Same aswithDriverJars(String)
but accepting a ValueProvider.withMaxConnections
(Integer maxConnections) Sets the maximum total number of connections.withMaxConnections
(ValueProvider<@Nullable Integer> maxConnections) Same aswithMaxConnections(Integer)
but accepting a ValueProvider.withPassword
(@Nullable String password) withPassword
(ValueProvider<@Nullable String> password) withQueryTimeout
(Integer queryTimeout) Sets the default query timeout that will be used for connections created by this source.withQueryTimeout
(ValueProvider<@Nullable Integer> queryTimeout) Same aswithQueryTimeout(Integer)
but accepting a ValueProvider.withUsername
(@Nullable String username) withUsername
(ValueProvider<@Nullable String> username)
-
Constructor Details
-
DataSourceConfiguration
public DataSourceConfiguration()
-
-
Method Details
-
create
-
create
-
create
public static JdbcIO.DataSourceConfiguration create(ValueProvider<@Nullable String> driverClassName, ValueProvider<@Nullable String> url) -
withUsername
-
withUsername
-
withPassword
-
withPassword
-
withConnectionProperties
Sets the connection properties passed to driver.connect(...). Format of the string must be [propertyName=property;]*NOTE - The "user" and "password" properties can be add via
withUsername(String)
,withPassword(String)
, so they do not need to be included here. -
withConnectionProperties
public JdbcIO.DataSourceConfiguration withConnectionProperties(ValueProvider<@Nullable String> connectionProperties) Same aswithConnectionProperties(String)
but accepting a ValueProvider. -
withConnectionInitSqls
public JdbcIO.DataSourceConfiguration withConnectionInitSqls(Collection<@Nullable String> connectionInitSqls) Sets the connection init sql statements to driver.connect(...).NOTE - This property is not applicable across databases. Only MySQL and MariaDB support this. A Sql exception is thrown if your database does not support it.
-
withConnectionInitSqls
public JdbcIO.DataSourceConfiguration withConnectionInitSqls(ValueProvider<Collection<@Nullable String>> connectionInitSqls) Same aswithConnectionInitSqls(Collection)
but accepting a ValueProvider. -
withMaxConnections
Sets the maximum total number of connections. Use a negative value for no limit. -
withMaxConnections
public JdbcIO.DataSourceConfiguration withMaxConnections(ValueProvider<@Nullable Integer> maxConnections) Same aswithMaxConnections(Integer)
but accepting a ValueProvider. -
withQueryTimeout
Sets the default query timeout that will be used for connections created by this source. -
withQueryTimeout
public JdbcIO.DataSourceConfiguration withQueryTimeout(ValueProvider<@Nullable Integer> queryTimeout) Same aswithQueryTimeout(Integer)
but accepting a ValueProvider. -
withDriverClassLoader
Sets the class loader instance to be used to load the JDBC driver. If not specified, the default class loader is used. -
withDriverJars
Comma separated paths for JDBC drivers. This method is filesystem agnostic and can be used for all FileSystems supported by Beam If not specified, the default classloader is used to load the jars.For example, gs://your-bucket/driver_jar1.jar,gs://your-bucket/driver_jar2.jar.
-
withDriverJars
Same aswithDriverJars(String)
but accepting a ValueProvider. -
buildDatasource
-