Package org.apache.beam.sdk.io.jdbc
Class JdbcIO.DataSourceConfiguration
- java.lang.Object
-
- org.apache.beam.sdk.io.jdbc.JdbcIO.DataSourceConfiguration
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- JdbcIO
public abstract static class JdbcIO.DataSourceConfiguration extends java.lang.Object implements java.io.SerializableA POJO describing aDataSource, either providing directly aDataSourceor all properties allowing to create aDataSource.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DataSourceConfiguration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.sql.DataSourcebuildDatasource()static JdbcIO.DataSourceConfigurationcreate(java.lang.String driverClassName, java.lang.String url)static JdbcIO.DataSourceConfigurationcreate(javax.sql.DataSource dataSource)static JdbcIO.DataSourceConfigurationcreate(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> driverClassName, org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> url)JdbcIO.DataSourceConfigurationwithConnectionInitSqls(java.util.Collection<@Nullable java.lang.String> connectionInitSqls)Sets the connection init sql statements to driver.connect(...).JdbcIO.DataSourceConfigurationwithConnectionInitSqls(org.apache.beam.sdk.options.ValueProvider<java.util.Collection<@Nullable java.lang.String>> connectionInitSqls)Same aswithConnectionInitSqls(Collection)but accepting a ValueProvider.JdbcIO.DataSourceConfigurationwithConnectionProperties(java.lang.String connectionProperties)Sets the connection properties passed to driver.connect(...).JdbcIO.DataSourceConfigurationwithConnectionProperties(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> connectionProperties)Same aswithConnectionProperties(String)but accepting a ValueProvider.JdbcIO.DataSourceConfigurationwithDriverClassLoader(java.lang.ClassLoader driverClassLoader)Sets the class loader instance to be used to load the JDBC driver.JdbcIO.DataSourceConfigurationwithDriverJars(java.lang.String driverJars)Comma separated paths for JDBC drivers.JdbcIO.DataSourceConfigurationwithDriverJars(org.apache.beam.sdk.options.ValueProvider<java.lang.String> driverJars)Same aswithDriverJars(String)but accepting a ValueProvider.JdbcIO.DataSourceConfigurationwithMaxConnections(java.lang.Integer maxConnections)Sets the maximum total number of connections.JdbcIO.DataSourceConfigurationwithMaxConnections(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.Integer> maxConnections)Same aswithMaxConnections(Integer)but accepting a ValueProvider.JdbcIO.DataSourceConfigurationwithPassword(@Nullable java.lang.String password)JdbcIO.DataSourceConfigurationwithPassword(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> password)JdbcIO.DataSourceConfigurationwithUsername(@Nullable java.lang.String username)JdbcIO.DataSourceConfigurationwithUsername(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> username)
-
-
-
Method Detail
-
create
public static JdbcIO.DataSourceConfiguration create(javax.sql.DataSource dataSource)
-
create
public static JdbcIO.DataSourceConfiguration create(java.lang.String driverClassName, java.lang.String url)
-
create
public static JdbcIO.DataSourceConfiguration create(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> driverClassName, org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> url)
-
withUsername
public JdbcIO.DataSourceConfiguration withUsername(@Nullable java.lang.String username)
-
withUsername
public JdbcIO.DataSourceConfiguration withUsername(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> username)
-
withPassword
public JdbcIO.DataSourceConfiguration withPassword(@Nullable java.lang.String password)
-
withPassword
public JdbcIO.DataSourceConfiguration withPassword(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> password)
-
withConnectionProperties
public JdbcIO.DataSourceConfiguration withConnectionProperties(java.lang.String connectionProperties)
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(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.String> connectionProperties)
Same aswithConnectionProperties(String)but accepting a ValueProvider.
-
withConnectionInitSqls
public JdbcIO.DataSourceConfiguration withConnectionInitSqls(java.util.Collection<@Nullable java.lang.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(org.apache.beam.sdk.options.ValueProvider<java.util.Collection<@Nullable java.lang.String>> connectionInitSqls)
Same aswithConnectionInitSqls(Collection)but accepting a ValueProvider.
-
withMaxConnections
public JdbcIO.DataSourceConfiguration withMaxConnections(java.lang.Integer maxConnections)
Sets the maximum total number of connections. Use a negative value for no limit.
-
withMaxConnections
public JdbcIO.DataSourceConfiguration withMaxConnections(org.apache.beam.sdk.options.ValueProvider<@Nullable java.lang.Integer> maxConnections)
Same aswithMaxConnections(Integer)but accepting a ValueProvider.
-
withDriverClassLoader
public JdbcIO.DataSourceConfiguration withDriverClassLoader(java.lang.ClassLoader driverClassLoader)
Sets the class loader instance to be used to load the JDBC driver. If not specified, the default class loader is used.
-
withDriverJars
public JdbcIO.DataSourceConfiguration withDriverJars(java.lang.String driverJars)
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
public JdbcIO.DataSourceConfiguration withDriverJars(org.apache.beam.sdk.options.ValueProvider<java.lang.String> driverJars)
Same aswithDriverJars(String)but accepting a ValueProvider.
-
buildDatasource
public javax.sql.DataSource buildDatasource()
-
-