Class JdbcIO.DataSourceConfiguration
- All Implemented Interfaces:
Serializable
- Enclosing class:
JdbcIO
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) Sets the database password.withPassword(ValueProvider<@Nullable String> password) Same aswithPassword(String)but accepting a ValueProvider.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.withSecretManager(@Nullable String secretManager) Sets the secret manager provider.withSecretManager(ValueProvider<@Nullable String> secretManager) Same aswithSecretManager(String)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
Sets the database password.You can specify a plain password string. Alternatively, if a secret manager is configured via
withSecretManager(String), you can set this to a secret specification in JSON format (e.g."{\"name\": \"my-db-secret\", \"project\": \"my-project\"}"for Google Cloud Secret Manager) that the secret manager uses to retrieve the password. -
withPassword
Same aswithPassword(String)but accepting a ValueProvider. -
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. -
withSecretManager
Sets the secret manager provider.Currently supported options are:
"GoogleCloudSecretManager""GoogleCloudHsmGeneratedSecretManager"
If not set, no secret manager is used and the password is treated as a plain password.
-
withSecretManager
public JdbcIO.DataSourceConfiguration withSecretManager(ValueProvider<@Nullable String> secretManager) Same aswithSecretManager(String)but accepting a ValueProvider. -
buildDatasource
-