public abstract static class JdbcIO.DataSourceConfiguration
extends java.lang.Object
implements java.io.Serializable
DataSource
, either providing directly a DataSource
or all
properties allowing to create a DataSource
.Constructor and Description |
---|
DataSourceConfiguration() |
Modifier and Type | Method and Description |
---|---|
javax.sql.DataSource |
buildDatasource() |
static JdbcIO.DataSourceConfiguration |
create(javax.sql.DataSource dataSource) |
static JdbcIO.DataSourceConfiguration |
create(java.lang.String driverClassName,
java.lang.String url) |
static JdbcIO.DataSourceConfiguration |
create(ValueProvider<java.lang.String> driverClassName,
ValueProvider<java.lang.String> url) |
JdbcIO.DataSourceConfiguration |
withConnectionInitSqls(java.util.Collection<java.lang.String> connectionInitSqls)
Sets the connection init sql statements to driver.connect(...).
|
JdbcIO.DataSourceConfiguration |
withConnectionInitSqls(ValueProvider<java.util.Collection<java.lang.String>> connectionInitSqls)
Same as
withConnectionInitSqls(Collection) but accepting a ValueProvider. |
JdbcIO.DataSourceConfiguration |
withConnectionProperties(java.lang.String connectionProperties)
Sets the connection properties passed to driver.connect(...).
|
JdbcIO.DataSourceConfiguration |
withConnectionProperties(ValueProvider<java.lang.String> connectionProperties)
Same as
withConnectionProperties(String) but accepting a ValueProvider. |
JdbcIO.DataSourceConfiguration |
withDriverClassLoader(java.lang.ClassLoader driverClassLoader)
Sets the class loader instance to be used to load the JDBC driver.
|
JdbcIO.DataSourceConfiguration |
withDriverJars(java.lang.String driverJars)
Comma separated paths for JDBC drivers.
|
JdbcIO.DataSourceConfiguration |
withDriverJars(ValueProvider<java.lang.String> driverJars)
Same as
withDriverJars(String) but accepting a ValueProvider. |
JdbcIO.DataSourceConfiguration |
withMaxConnections(java.lang.Integer maxConnections)
Sets the maximum total number of connections.
|
JdbcIO.DataSourceConfiguration |
withMaxConnections(ValueProvider<java.lang.Integer> maxConnections)
Same as
withMaxConnections(Integer) but accepting a ValueProvider. |
JdbcIO.DataSourceConfiguration |
withPassword(@Nullable java.lang.String password) |
JdbcIO.DataSourceConfiguration |
withPassword(ValueProvider<java.lang.String> password) |
JdbcIO.DataSourceConfiguration |
withUsername(@Nullable java.lang.String username) |
JdbcIO.DataSourceConfiguration |
withUsername(ValueProvider<java.lang.String> username) |
public static JdbcIO.DataSourceConfiguration create(javax.sql.DataSource dataSource)
public static JdbcIO.DataSourceConfiguration create(java.lang.String driverClassName, java.lang.String url)
public static JdbcIO.DataSourceConfiguration create(ValueProvider<java.lang.String> driverClassName, ValueProvider<java.lang.String> url)
public JdbcIO.DataSourceConfiguration withUsername(@Nullable java.lang.String username)
public JdbcIO.DataSourceConfiguration withUsername(ValueProvider<java.lang.String> username)
public JdbcIO.DataSourceConfiguration withPassword(@Nullable java.lang.String password)
public JdbcIO.DataSourceConfiguration withPassword(ValueProvider<java.lang.String> password)
public JdbcIO.DataSourceConfiguration withConnectionProperties(java.lang.String connectionProperties)
NOTE - The "user" and "password" properties can be add via withUsername(String)
,
withPassword(String)
, so they do not need to be included here.
public JdbcIO.DataSourceConfiguration withConnectionProperties(ValueProvider<java.lang.String> connectionProperties)
withConnectionProperties(String)
but accepting a ValueProvider.public JdbcIO.DataSourceConfiguration withConnectionInitSqls(java.util.Collection<java.lang.String> connectionInitSqls)
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.
public JdbcIO.DataSourceConfiguration withConnectionInitSqls(ValueProvider<java.util.Collection<java.lang.String>> connectionInitSqls)
withConnectionInitSqls(Collection)
but accepting a ValueProvider.public JdbcIO.DataSourceConfiguration withMaxConnections(java.lang.Integer maxConnections)
public JdbcIO.DataSourceConfiguration withMaxConnections(ValueProvider<java.lang.Integer> maxConnections)
withMaxConnections(Integer)
but accepting a ValueProvider.public JdbcIO.DataSourceConfiguration withDriverClassLoader(java.lang.ClassLoader driverClassLoader)
public JdbcIO.DataSourceConfiguration withDriverJars(java.lang.String driverJars)
For example, gs://your-bucket/driver_jar1.jar,gs://your-bucket/driver_jar2.jar.
public JdbcIO.DataSourceConfiguration withDriverJars(ValueProvider<java.lang.String> driverJars)
withDriverJars(String)
but accepting a ValueProvider.public javax.sql.DataSource buildDatasource()