public static class JdbcLogger.Builder extends Object
Constructor and Description |
---|
Builder(com.fishlib.io.logger.Logger logger,
String jdbcDriver,
String jdbcUrl,
String tableName)
Initialize a JdbcLogger builder with the given logger, JDBC connection, and target table information.
|
Builder(com.fishlib.io.logger.Logger logger,
String jdbcDriver,
String jdbcUrl,
String schema,
String tableName)
Initialize a JdbcLogger builder with the given logger, JDBC connection, and target table information.
|
Builder(com.fishlib.io.logger.Logger logger,
String jdbcDriver,
String jdbcUrl,
String catalog,
String schema,
String tableName)
Initialize a JdbcLogger builder with the given logger, JDBC connection, and target table information.
|
Modifier and Type | Method and Description |
---|---|
JdbcLogger.Builder |
batchSize(int batchSize)
Specify the batch size when writing to the JDBC data source.
|
JdbcLogger |
build()
Creates a JdbcLogger with configuration specified by arguments to the builder.
|
JdbcLogger.Builder |
calendar(Calendar calendar)
Specify the Calendar to use when logging to JDBC date/datetime/timestamp columns.
|
JdbcLogger.Builder |
dataColumn(String targetColumn)
Add a data column for logging, with the same name in the source and target.
|
JdbcLogger.Builder |
dataColumn(String targetColumn,
String sourceColumn)
Add a data column for logging, mapping a source Deephaven column to a target JDBC column.
|
JdbcLogger.Builder |
jdbcPassword(String jdbcPassword)
Specify the JDBC database password.
|
JdbcLogger.Builder |
jdbcUser(String jdbcUser)
Specify the JDBC database user.
|
JdbcLogger.Builder |
keyColumns(String... keyColumns)
Specify the set of columns that represent the primary key when logging to JDBC.
|
JdbcLogger.Builder |
logMode(boolean logMode)
Set log mode indicator.
|
JdbcLogger.Builder |
operationColumn(String operationColumn)
Specify the JDBC column that will receive the operation that resulted in that row.
|
JdbcLogger.Builder |
rowIndexColumn(String rowIndexColumn)
Specify the JDBC column that will receive the rowIndex of the source table row that resulted in a given
JDBC row.
|
public Builder(com.fishlib.io.logger.Logger logger, String jdbcDriver, String jdbcUrl, String catalog, String schema, String tableName)
logger
- the logger to use when initializingjdbcDriver
- the JDBC driver class namejdbcUrl
- the JDBC connection URLcatalog
- the JDBC database catalogschema
- the JDBC database schematableName
- the JDBC database table namepublic Builder(com.fishlib.io.logger.Logger logger, String jdbcDriver, String jdbcUrl, String schema, String tableName)
logger
- the logger to use when initializingjdbcDriver
- the JDBC driver class namejdbcUrl
- the JDBC connection URLschema
- the JDBC database schematableName
- the JDBC database table namepublic Builder(com.fishlib.io.logger.Logger logger, String jdbcDriver, String jdbcUrl, String tableName)
logger
- the logger to use when initializingjdbcDriver
- the JDBC driver class namejdbcUrl
- the JDBC connection URLtableName
- the JDBC database table namepublic JdbcLogger.Builder jdbcUser(String jdbcUser)
jdbcUser
- JDBC database user namepublic JdbcLogger.Builder jdbcPassword(String jdbcPassword)
jdbcPassword
- JDBC database passwordpublic JdbcLogger.Builder calendar(Calendar calendar)
PreparedStatement.setDate(int, Date, Calendar)
and
PreparedStatement.setTimestamp(int, Timestamp, Calendar)
(int, Date, Calendar)} for details.calendar
- the Calendar to use for loggingpublic JdbcLogger.Builder batchSize(int batchSize)
TableLoggerBase.Flags
setting is not "RowByRow", since that
effectively requires a commit for every row. When logging with updates, the "Atomic" setting is recommended,
which requires only one commit for each Deephaven table update (which can affect any number of rows). When
logging snapshots only, any setting other than "RowByRow" will take advantage of batching.batchSize
- the maximum batch size (legal range is 1 to 100,000)public JdbcLogger.Builder logMode(boolean logMode)
logMode
- if true, run in log modepublic JdbcLogger.Builder rowIndexColumn(String rowIndexColumn)
PreparedStatement.setLong(int, long)
will be used to set this value, so the target column
should be an SQL BIGINT or equivalent.rowIndexColumn
- the JDBC column that will receive the operation (must be compatible with 64 bit integer)public JdbcLogger.Builder operationColumn(String operationColumn)
PreparedStatement.setString(int, java.lang.String)
will be used to set this value, so the target column
should be a VARCHAR with length 11 or more.operationColumn
- the JDBC column that will receive the operation (must be compatible with a string value)public JdbcLogger.Builder dataColumn(String targetColumn)
targetColumn
- the column namepublic JdbcLogger.Builder dataColumn(String targetColumn, String sourceColumn)
targetColumn
- column name in the JDBC tablesourceColumn
- column name in the source Deephaven tablepublic JdbcLogger.Builder keyColumns(String... keyColumns)
keyColumns
- an array of columns to use as the composite primary keypublic JdbcLogger build() throws SQLException
SQLException
- if an error occurs while