public class JdbcMultiWriter extends ProxyWriter
DataEndpoint.State
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
JdbcMultiWriter(DataSource dataSource,
int connections,
int maxQueuedRecordsPerConnection,
String tableName) |
JdbcMultiWriter(DataSource dataSource,
int connections,
int maxQueuedRecordsPerConnection,
String tableName,
IInsert insert) |
JdbcMultiWriter(JdbcConnectionFactory factory,
int connections,
int maxQueuedRecordsPerConnection,
String tableName) |
JdbcMultiWriter(JdbcConnectionFactory factory,
int connections,
int maxQueuedRecordsPerConnection,
String tableName,
IInsert insert) |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
protected JdbcWriter |
createJdbcWriter(Connection connection,
String tableName,
IInsert insertStrategy) |
AsyncWriter |
getAsyncWriter(int index) |
int |
getBatchSize() |
int |
getConnections() |
DataException |
getException()
Returns an exception thrown by one of the internal AsyncWriters if any.
|
List<DataException> |
getExceptions()
Returns all exceptions thrown by the internal AsyncWriters (the list will not be null, but may contain no elements).
|
IInsert |
getInsert() |
Integer |
getJdbcType(Class<?> type)
The
Types constant (or a database specific value) assigned to the specified Java class type using setJdbcType(Class, int) or null if none was set. |
JdbcWriter |
getJdbcWriter(int index) |
boolean |
isCommitBatch()
Indicates if this writer should call commit on each connection after every batch is sent,
otherwise, commit is called after the final batch update (default is false).
|
boolean |
isDebug()
Indicates if the generated SQL should be logged (default false).
|
void |
open()
Makes this endpoint ready for reading or writing.
|
void |
rethrowAsyncException()
Re-throws an exception thrown by one of the internal AsyncWriters or returns silently if no exceptions were thrown.
|
JdbcMultiWriter |
setBatchSize(int batchSize)
Sets the number of records to chunk together in batch updates.
|
JdbcMultiWriter |
setCommitBatch(boolean commitBatch)
Indicates if this writer should call commit on each connection after every batch is sent,
otherwise, commit is called after the final batch update (default is false).
|
JdbcMultiWriter |
setDebug(boolean debug)
Indicates if the generated SQL should be logged (default false).
|
JdbcMultiWriter |
setJdbcType(Class<?> type,
int jdbcType)
Forces field values of the specified Java class type to be sent to the database using
PreparedStatement.setObject(parameterIndex, fieldValue, jdbcType)
(instead of the appropriate PreparedStatement.setXXX() method for its field's type). |
JdbcMultiWriter |
setJdbcType(String fieldName,
int jdbcType)
The given Java object will be converted to the given targetSqlType before being sent to the database.
|
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter . |
available, close, getNestedWriter, interceptRecord, map, map, setNestedDataWriter, setNestedDataWriter
getNestedEndpoint, getRootEndpoint, getRootWriter, write
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
public JdbcMultiWriter(DataSource dataSource, int connections, int maxQueuedRecordsPerConnection, String tableName, IInsert insert)
public JdbcMultiWriter(DataSource dataSource, int connections, int maxQueuedRecordsPerConnection, String tableName)
public JdbcMultiWriter(JdbcConnectionFactory factory, int connections, int maxQueuedRecordsPerConnection, String tableName, IInsert insert) throws DataException
DataException
public JdbcMultiWriter(JdbcConnectionFactory factory, int connections, int maxQueuedRecordsPerConnection, String tableName) throws DataException
DataException
public int getConnections()
public JdbcWriter getJdbcWriter(int index)
public AsyncWriter getAsyncWriter(int index)
public int getBatchSize()
public JdbcMultiWriter setBatchSize(int batchSize)
public boolean isCommitBatch()
public JdbcMultiWriter setCommitBatch(boolean commitBatch)
public IInsert getInsert()
public JdbcMultiWriter setJdbcType(String fieldName, int jdbcType)
The given Java object will be converted to the given targetSqlType before being sent to the database.
Note that this method may be used to pass database-specific abstract data types.
fieldName
- jdbcType
- the object containing the JDBC Type parameter valuepublic JdbcMultiWriter setJdbcType(Class<?> type, int jdbcType)
PreparedStatement.setObject(parameterIndex, fieldValue, jdbcType)
(instead of the appropriate PreparedStatement.setXXX()
method for its field's type). This method may be used to pass database-specific abstract data types.type
- the Java class type to override.jdbcType
- one of the Types
constants or a database specific value.public Integer getJdbcType(Class<?> type)
Types
constant (or a database specific value) assigned to the specified Java class type using setJdbcType(Class, int)
or null if none was set.Types
constants or a database specific value.public boolean isDebug()
public JdbcMultiWriter setDebug(boolean debug)
public void open() throws DataException
DataEndpoint
open
in class ProxyWriter
DataException
protected JdbcWriter createJdbcWriter(Connection connection, String tableName, IInsert insertStrategy)
protected void writeImpl(Record record) throws Throwable
DataWriter
DataWriter
.writeImpl
in class ProxyWriter
Throwable
public DataException getException()
public List<DataException> getExceptions()
public void rethrowAsyncException() throws DataException
DataException
public DataException addExceptionProperties(DataException exception)
Endpoint
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class ProxyWriter
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.